You need to sign in to do that
Don't have an account?
shaanRocks
Passing values to multipicklist Field
How can i pass values form a string to multipicklist field.
I need to update a multipicklist field.
I have concatenated a list of values to a string as:
string str = '1; 2; 3; 4';
I thought of passing these values directly to the field but the field is not being updated.
Please let me know what needs to be done.
Please paste the code you have written.
I have tried using replaceAll method but it is not working.
Here is my Requirement:
I have a Value stored in string now how to pass value of a string to a multi picklist field of an object using apex code.
I have a value stored in a string as:
string str =
All Answers
Hi there.
I am pretty sure, based on code I have written, that you should be able to do that exactly. Have you checked if other parts of your code are in error?
Regards,
Ivar
Please paste the code you have written.
I have tried using replaceAll method but it is not working.
Here is my Requirement:
I have a Value stored in string now how to pass value of a string to a multi picklist field of an object using apex code.
I have a value stored in a string as:
string str =
Hi again shaanRocks.
I can't unfortunately paste the code since it was for a client and not my property, but I whipped up an extremely simple piece of code that works to illustrate the assignment.
I logged into my development org, created a new object called "Nugget", and on that I created a new Multiselect picklist named "mplMultilist__c'.
I then created this very simple trigger that works and illustrates how you assign the string value to the field:
If I now create a new Nugget object the multilist is set to those three values.
Hope this helps clarify.
Regards,
Ivar
Hi Ivar,
Thanks for your reply. The issue was with my code.
Now its working fine can pass directly a string to multipicklist.
Thanks again!