I have a picklist and a multi-select picklist field. The picklist values are same in both the fields. Whenever I chose a value in the picklist field and save the record, the picklist value should be selected in the Multi-Select picklist field.

Example: Picklist field has A, B, C, D..... Z values. Multi-select Picklist will also have A, B, C, D... Z values. When I choose B in Picklist field and save my multi-select Picklist also should have B selected as a value. Now if I chose F for my picklist field, Multi-Select picklist should have both B and F values selected in the background.

Can someone help me with this logic?


  • 5
    What have you tried so far? Where are you stuck?
    – David Reed
    Nov 26 '18 at 17:58

This should get you close.

public static void syncPickLists(List<SObject> records, String picklistName, String multiPicklistName) {
    for (SObject record : records) {
        String multiValue = record.get(multiPicklistName);
        String pickValue = record.get(picklistName);

        if (!multiValue.contains(pickValue)) {
            if (multiValue != null && multiValue != '') {
                mutliValue += ';';

            multiValue += pickvalue;

        record.put(multiPicklistName, multiValue);

Just toss that bad boy into a before trigger and you should be good to go.

I am not sure if this is possible via wf or pbs. Maybe you could work out a formula for a PB.

Something like:

IF(NOT(INCLUDES(multiField__c, pickfield__c)), multiField__c + ';' + pickField__c, multiField__c)

The key takeaway is that I believe multi-picklists are stored as semi-colon delimited strings.



If you do not write Apex, you can achieve this via Process Builder.

Create a process that runs when the object record is updated, and these criteria are met:

ischanged(picklistField) = TRUE 
picklistField != null

Then, update the same record that triggered the process, and update the multiselect picklist field with this formula:

PRIORVALUE([object].multiSelectPicklistField) & '; ' & TEXT([object].picklistField)

This will work properly even when an update tries to add the same multiselect picklist value twice (it will only appear once).

A Workflow field update won't work, as per https://success.salesforce.com/ideaView?id=08730000000l0kHAAQ

  • 1
    As it stands, your formula only tracks the current and previous pick list values. OP said they wanted it to track all values of that picklist each time it's changed and did not include any criteria in terms of only storing 2 values at a time. It's a great solution, but I don't think it truly addresses OPS needs, or OP needs to update their question with more information.
    – gNerb
    Nov 26 '18 at 22:30
  • Ah, thank you, I changed the formula to capture all previous values rather than just current and previous.
    – Mobot818
    Nov 26 '18 at 22:36
  • I don't know that I would use the prior value at all, If I were to manually add a value to the multi-picklist field it could be overridden.
    – gNerb
    Nov 26 '18 at 22:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.