You need to sign in to do that
Don't have an account?
Miki Nagikawa
Update a picklist value to a picklist value using APEX
I have a list of values in one picklist field (A) and would like to have some of those values (abc, dfe) trigger to update another picklist field's (B) value (xyz) upon selection. The reason i would like to use Apex is because I have a field dependency already used for those fields and cannot overwrite it with another dependency. Any suggestion? I am new to apex and I have trouble creating the trigger.
You can use picklist field the same way as a plain text field.
if(obj.picklistValueA == 'abc' || obj.picklistValueA == 'dfe')
{
obj.picklistValueB ='xyz';
}
Thanks and Regards
Ajay Rawat
All Answers
You can use picklist field the same way as a plain text field.
if(obj.picklistValueA == 'abc' || obj.picklistValueA == 'dfe')
{
obj.picklistValueB ='xyz';
}
Thanks and Regards
Ajay Rawat
Thank you for your reply!
I am getting an error as shown below:
Do you know where it is wrong?
Miki
If I would like this trigger to run BEFORE saving, what or where would I modify?
Miki
(after insert, after update , before insert, before update)
Is there a way it would update while editing/creating new opportunity?
Can you help me just opposite to this.
Lookup to picklist value updation using trigger