cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeanpro
Level: Powered On

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 Smiley Happy

1 REPLY 1
MichaelMS
Level: Powered On

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.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 353 members 5,223 guests
Please welcome our newest community members: