AnsweredAssumed Answered

Updating Form Picklist Values Using the REST API

Question asked by Don Martin on Nov 22, 2019
Latest reply on Nov 24, 2019 by Sanford Whiteman

Hello,

 

Maybe someone can help me out here.  This is my first Marketo post.

 

I'm not a user of Marketo but a SalesForce developer.  I've been tasked with updating a form field picklist value across multiple Marketo forms.  I've decided to use the Marketo REST API to do this.  Ideally, I'll be given a list of Marketo form id's to cycle through to update a customer/prospect name field.  Since we sell to school districts, this picklist will be over 10,000 records in length.  Once the picklist is updated, I'll set visibility rules for this field based upon state.

 

I've studied very closely the Marketo Asset REST API documentation and have performed multiple Google searches to try to find the answer to my question.

 

I've used SOAP UI and my SalesForce code to perform some basic tests already.  I can get the access token and make REST calls to update the field on a test form that I was given.  This only works if the "content-type" on the request header is set to "application/x-www-form-urlencoded" and I supply a data package that looks like this:

values=[{"value":"Don XXXXXXXXXXX District","label":"Don XXXXXXXXXXX District"},{"value":"Jefferson Co School District","label":"Jefferson Co School District"}]  This won't work in production for us, since the data package will need to contain >10,000 records.  My research says that if the content-type is set to "application/x-www-form-urlencoded" , the data package is just added to the URL.  I really need to have the application type set to "application/json".

 

When I change the content type to "application/json", and supply a properly formatted JSON package that looks like this:

{
"values":[{"value":"Don 333 District","label":"Don 333 District"},{"value":"Jefferson Co School District","label":"Jefferson Co School District"}]
}, the JSON response from Marketo says that it was success but non of the picklist values are updated.  I can see this immediately in the JSON response from Marketo.

 

The Marketo REST API documentation for form field update defines the JSON package as this:

{
  "blankFields": 0,
  "defaultValue": "string",
  "fieldType": "string",
  "fieldWidth": 0,
  "formPrefill": true,
  "hintText": "string",
  "initiallyChecked": true,
  "instructions": "string",
  "label": "string",
  "labelToRight": true,
  "labelWidth": 0,
  "maskInput": "string",
  "maxLength": 0,
  "maxValue": 0,
  "minValue": 0,
  "multiSelect": true,
  "required": true,
  "validationMessage": "string",
  "values": "string",
  "visibleLines": 0
}

 

What's strange is that the values parameter is defined by Marketo as string instead of a list of label, value pairs.  The only example given by Marketo for a form field update REST call specifies a content-type of "application/x-www-form-urlencoded" which does not work for me.

 

I've done REST integrations between SalesForce and at least two other platforms (Chargify and custom internal REST endpoints) and have never had any problems.  Is there something wrong with Marketo's REST implementation and documentation?

 

Thanks for any help or Insight:

Don Martin

Outcomes