cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Updating record in Salesforce with multi-select picklist

Hi all,

 

I am having an issue when updating a record using the Salesforce connector. The issue only happens when I try to update a field in the record that has multi-select picklist:

 

brands.JPG

 

When I try to update this field, the request receives the below error:

 

 

{
  "status": 400,
  "message": "A value must be provided for item.\r\nclientRequestId: 99098cd0-2514-426d-978c-****",
  "source": "salesforce-*****"
}

 

 

On the other hand, when I try to update the same record without referring to any of the picklist fields I receive a successfull response with all record fields, looking carefully at the picklist fields I notice that they have a "@odata.type" definition:

 

 

{
  "@odata.context": "https://sales*****.net/v2/$metadata#datasets('default')/tables('Contact')/items/$entity",
  "@odata.etag": "",
  "ItemInternalId": "1e76702a-fa17-48ab-9fa1-*****",
  "Id": "003570000****M",
****** MULTIPLE OTHER FIELDS ******
  "Last_Checked_By__c": null,
  "Extension_Number__c": null,
  "Liner_Brands__c@odata.type": "#Collection(String)",
  "Liner_Brands__c": [
    "Se****"
  ],
  "Decision_Maker__c@odata.type": "#Collection(String)",
  "Decision_Maker__c": [],
  "Contact_Type__c@odata.type": "#Collection(String)",
  "Contact_Type__c": [
    "Commercial"
  ],
  "External_ID__c": "BR0****1705",
  "First_Name_English__c": "Leandro",
  "Last_Name_English__c": "Paozinho",
  "Team_Contact__c": "No"
}

 

 

When I tried to use the update by EXTERNAL Id action I received a more detailed explanation:

 

 

 

{
  "error": {
    "code": 502,
    "source": "flow-*****m.net",
    "clientRequestId": "a5f83d7d-e714-4ace-b788-*****",
    "message": "BadGateway",
    "innerError": {
      "status": 502,
      "message": "Salesforce failed to complete task: Message: Cannot deserialize instance of multipicklist from START_ARRAY value [line:1, column:23]\r\nclientRequestId: a5f83d7d-e714-4ace-b788-******",      "source": "Salesforce.Common",
      "errors": []
    }
  }
}

 

 

Hence the question is: How can I adapt my body to define the data type on it?

 

Current body generated from update record (not working):

 

{
"Field1": ["str1", "str2"]
}

 

 

Return from server (When not referring to the Field1 nor Field2):

[
   "Field1@odata.type": "#Collection(String)",
   "Field1": ["str1", "str2"],
  "Field2@odata.type": "#Collection(String)",
"Field2": ["str1", "str2"], ]

Any suggestion/comment is much appreciated!

 

Jean Phelippe

 

 

----------------------------

Quick Update:
I saw something workable for Sharepoint here: https://veenstra.me.uk/2018/04/18/microsoft-flow-create-sharepoint-list-item-and-get-a-badrequest/

But not sure how to adapt my Salesforce flow to incorporate this content definition. My knowledge on Odata is very limited. Appreciate any tips 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Frequent Visitor

Re: Updating record in Salesforce with multi-select picklist

I'm assuming that you have a salesforce multi-select pick list  and that you want flow to choose some values from it.

 

For example, multi-select picklist has allowable values of A, B, C, D. If you wanted to choose A and D. You need to have your data formatted as 

A;D

When updating the salesforce record, flow presents the field as an array where you can add elements. Something like this

Screen Shot 2019-09-23 at 1.12.15 am.png

You need to select Switch to entire array by clicking on the T symbol to the right of the field

Screen Shot 2019-09-23 at 1.13.57 am.png

This will change the field to accept the whole array at once. 

 

Now you can put the values A;D that you have into this field.

One warning, this won't work if you are using a string variable. Flow won't allow a string type to be stored in an array field. Instead store your string in a compose action. You can then assign the output from the compose to the array field.

View solution in original post

1 REPLY 1
Highlighted
Frequent Visitor

Re: Updating record in Salesforce with multi-select picklist

I'm assuming that you have a salesforce multi-select pick list  and that you want flow to choose some values from it.

 

For example, multi-select picklist has allowable values of A, B, C, D. If you wanted to choose A and D. You need to have your data formatted as 

A;D

When updating the salesforce record, flow presents the field as an array where you can add elements. Something like this

Screen Shot 2019-09-23 at 1.12.15 am.png

You need to select Switch to entire array by clicking on the T symbol to the right of the field

Screen Shot 2019-09-23 at 1.13.57 am.png

This will change the field to accept the whole array at once. 

 

Now you can put the values A;D that you have into this field.

One warning, this won't work if you are using a string variable. Flow won't allow a string type to be stored in an array field. Instead store your string in a compose action. You can then assign the output from the compose to the array field.

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (9,227)