I'm building a flow to append values to a Salesforce multi-select picklist field (Salesforce doesn't have this functionality natively built in, probably because they want people to stay away from multi-select picklists. Alas.)
In short, what my flow is supposed to do is, when an Event Registration record is created for an Event, it gets the Event's "Related Regions" multi-select field values and adds them to the "Regions of Interest" multi-select picklist field on the Contact record associated with the Event Registration record.
How I've set up my flow to do this, when an Event Registration Record is created:
1. Get Contact record associated with Event Registration record
2. Get Event Record associated with Event Registration record
3. Initialized a "Region Interests" string variable with the existing Regions of Interest on the Contact Record.
4. Append the string variable with the Event's "Related Regions" picklist field value(s).
5. Used a Compose action to get the outputs of the Region Interests variable.
6. Using an Update Salesforce Record action, using the Dynamic Content option, I input the Outputs of my Compose action into the array input for the "Regions of Interest" field on the Contact record. To note, I clicked the button next to the field on the contact record "Switch to input the entire array", which is where I am placing the "Outputs" from my Compose action on the Regions of Interest field.
When I run a test, I get this error:
Salesforce failed to complete task: Message: Regions of Interest: bad value for restricted picklist field: ["Africa","East Africa—Eritrea","East Asia—Korea"]
My Output from the compose action looked like this:
["Africa","East Africa—Eritrea","East Asia—Korea"]
I thought there was something wrong in my schema or formatting. However, after some unsuccessful attempts at solutions, I tried to just copy and paste the above into the Regions of Interest input on the Contact record, and it worked (see below).
So, I know my schema is correct, and the values are fine (not "bad" picklist values, like the error suggested).
Is the Compose action messing with how things are formatted? Is it that I'm using a String variable instead of an array? (If I need to use an array variable, what would be the schema?) How do I get the properly formatted array into that field?
I used the advice from this post but it didn't bring me to the right solution: https://powerusers.microsoft.com/t5/General-Power-Automate/Updating-record-in-Salesforce-with-multi-...
I solved this by Initializing an Array variable an Appending to that instead. I didn't have to input any schema for the value on the append, on the the Dynamic Content picklist field value from Salesforce for the pertinent record.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!
Did you know that you could restore a deleted flow? Check out this helpful article.