function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jmerrill8jmerrill8 

Simple Trigger help

Very new to Salesforce here.

 

I have 2 multi-select fields in my Lead object called "States Worked" and "States Licensed".

 

I want to create a third field called "All States" which will include all options chosen for both "States Worked" and "States Licensed".

 

I was thinking I could create a trigger that would update "All States" with the data selected for the other two fields.

 

Can anyone help me get started with this?

 

Thanks!

carlocarlo

Why do you think this is a Trigger?

jmerrill8jmerrill8

I'm certainly open to other solutions if you have any recommendations.

 

I was thinking a trigger would fire on insert or update and would populate field 3 with the values from field 1 and 2.

 

Field 1: CT, MA, ME

Field 2: NY, PA, WY

 

Field 3: CT, MA, ME, NY, PA, WY

 

Any suggestions would be much appreciated.

 

Thanks!

carlocarlo

I see now.  I thought you were wanting a 3rd pick list which would only contain values from field 1 and 2 but that the user would then need to make the selection.

 

Yes you can do this with a trigger.  I don't know how to deal with a multi pick list in apex as I've never used them.  I suppose they are just like a list so you need to generate a new list for field 3 and populate it with the values from the list of field 1 and field 2.