3

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.

6

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.

  • Ah, thanks. So the SOAP API ~= REST API? – Will Morgan Oct 31 '14 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 '14 at 17:52
  • That's perfect, and you're a saviour - I've been struggling with this for such a long time. – Will Morgan Oct 31 '14 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.