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
KuenKuen 

Selecting a picklist value programmatically

Hey all,

 

Wondering if it's possible to set a picklistEntry as "selected" programmatically. I know usually a user will be doing this, however, I want to do this programmatically because I'm sending an email to salesforce, and the value is already there.

 

Scenario: Send an email to salesforce that will create a custom object. The email will have the field for picklist as well as the picklistEntry.value() in a string format. ie. "Programming Languages: PHP, JS, RoR" I have it splitting up into "Programming Languages" and "PHP" "JS" "RoR".

 

Inside salesforce, there is a multipicklist(multi-select) for Programming Languages, for PHP, JS, RoR and more.

How do I make sure that the custom object field "Programming_Languages" will have PHP, JS, RoR selected and not the other ones?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Tim__mTim__m

Use a semicolon like this...

 

 

mySobj.Programming_Languages = 'PHP;JS;RoR';

 

 

All Answers

Tim__mTim__m

Use a semicolon like this...

 

 

mySobj.Programming_Languages = 'PHP;JS;RoR';

 

 

This was selected as the best answer
KuenKuen

Thanks!!! It works perfectly!