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
dereksfdereksf 

Salesforce API inserting values into multiselect fields using .NET

I am using an .NET webform to create a lead, but having problems with multiselect fields. I have a multiselect checkbox control in my webform where I allow a user to select various items. I then try to take the values and insert them into the salesforce multiselect field. My problem is that I only get one value into salesforce and not the entire list.

 

I tried various ways of looping through the values and concatenating them together, but it still only results in one value.

 

Any help would be appreciated.

 

thanks!

Best Answer chosen by Admin (Salesforce Developers) 
dereksfdereksf

And here is the answer to multiselect fields and inserting the values into salesforce through the API regardless of language.

Sometimes the answer is in the documentation if you just know where to find it.

 

To insert or update options in a multi-select picklist in an object you will need to separate all the picklist options with a semi-colon.

For example: a;b;c will insert all 3 picklist values of a, b and c into your multi-select picklist field for that record. It does not matter if you have spaces between your values and semi-colons.

Please note that any existing values selected in the multi select picklist field will be overwritten. If you would like to add values to the existing values selected you will first need to export the field contents, add the additional values you would like listed and then perform the update.

 

 

All Answers

dereksfdereksf

And here is the answer to multiselect fields and inserting the values into salesforce through the API regardless of language.

Sometimes the answer is in the documentation if you just know where to find it.

 

To insert or update options in a multi-select picklist in an object you will need to separate all the picklist options with a semi-colon.

For example: a;b;c will insert all 3 picklist values of a, b and c into your multi-select picklist field for that record. It does not matter if you have spaces between your values and semi-colons.

Please note that any existing values selected in the multi select picklist field will be overwritten. If you would like to add values to the existing values selected you will first need to export the field contents, add the additional values you would like listed and then perform the update.

 

 

This was selected as the best answer
WA_Ed_HagerWA_Ed_Hager
So what happens if the text you are adding needs to contain a semicolon?
marklarkmarklark

*crickets chirping*

 

Good question.

dereksfdereksf

Just Guessing, but possibly an escape code like backslash semicolon? (Apex strings can be escaped with backslashes)

 

It will be a while before I can test.

marklarkmarklark

Nope...  It just strips the ';' and leaves the '\'  

 

:^/

SuperfellSuperfell
That's not allowed for MSPs