4

Introduction

Hello, I'm working on synchronising data from a MySQL database into Salesforce using the REST API. I've got as far as inserting basic text values, but for complex field types such as picklist and lookup, I'm unable to find any documentation on the correct format. I've tried to send in objects and arrays, as well as having spent quite a few hours looking for solutions. I keep getting errors like:

{"message":"Cannot deserialize instance of multipicklist from START_ARRAY value [line:1, column:51]","errorCode":"JSON_PARSER_ERROR"}

From JSON payloads like:

{"FirstName":"Doug","LastName":"Proctor (testing)","s360__Contact_Code__c":["Individual supporter - donor"]}

Where s360__Contact_Code__c is a picklist field. I'm also having problems with lookups, where I need to refer to another object of the same type as a referrer.

As I said, I have no problems with actually getting basic objects into the database when I only populate text fields.

Question

Where would I find the correct formats when POSTing/PATCHing fields of these types?

Sorry if I'm not being clear, I'm a real Salesforce novice and the amount of information and capabilities the product has is quite overwhelming.

1 Answer 1

9

Picklist values are strings. Multi Select Picklist values are semicolon-separated strings. Lookups are 18 character strings where the 18 character string is the ID of the record being looked up to.

This documentation should help.

4
  • Ah, thanks. So the SOAP API ~= REST API? Oct 31, 2014 at 17:50
  • In terms of the data values, I think they are. In that if you want to populate a multi-select picklist field you'd do it with "A Selected Value;Another Selected Value" in either case.
    – Dominic
    Oct 31, 2014 at 17:52
  • That's perfect, and you're a saviour - I've been struggling with this for such a long time. Oct 31, 2014 at 18:04
  • The OP asked where the documentation is for the REST API not the SOAP API. Here it is: developer.salesforce.com/docs/atlas.en-us.api_rest.meta/…
    – Radmation
    Apr 1, 2020 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .