The requirement I have is that a multi-picklist (MSP) field ("Specialty") is updated based on any additional values from another multi-picklist field ("Specialty Marketing") with the same picklist options. This means any values on field B should be ADDED (not overwritten) to the already selected values on field A. I need to do this using Salesforce Flow and although I think I got the flow right, I am not too confident about the formula which updates the "Specialty" (varSpecialtyMSPvalue) field with values from the "Specialty Marketing (newSpecialtyMSPvalue)" values.
IF(ISBLANK({!varSpecialtyMSPvalue}),
{!newSpecialtyMSPvalue},
IF(NOT(CONTAINS({!varSpecialtyMSPvalue},{!newSpecialtyMSPvalue})),
SUBSTITUTE(SUBSTITUTE({!varSpecialtyMSPvalue},'[',''),']',';'+{!newSpecialtyMSPvalue}),
SUBSTITUTE(SUBSTITUTE({!varSpecialtyMSPvalue},'[',''),']','')
))
EDIT: The formula is correct in terms of syntax as I can run the flow but the field is overwritten instead of appended (i.e. existing values are removed and new values are added). During debug, I get the following results:
1. Successfully found record. {!varSpecialtyMSPvalue} = null
2. Update the records’ field values. EMEA_Specialty__c = {!Update_Specialty_Field} (null)
What am I missing? Thank you to whoever takes the time to give me guidance!
Below a snapshot of my flow elements for additional context:
INCLUDES
rather thanCONTAINS
for multi-select picklists. (See help.salesforce.com/s/… | salesforce.stackexchange.com/q/198532/81648). If your 2nd field does not have to be multi-select, and could be a formula field instead, you might could do this without a Flow: help.salesforce.com/s/articleView?id=000322999&type=1.