Getting states of other countries to a Marketo form

Level 3

Getting states of other countries to a Marketo form

Hello everyone,

A question to all - A customer, spanning across many countries, wants to have the values in the state field of all the 700 state and then define visibility rules accordingly. The problem is Marketo only has 50 US states by default.

image (3).png

I understand that we can manually go ahead and change these default values in a form. But if states are added in real time , then these forms would need to be manually updated each time.

e.g., If I am designing a form for a company, operating in Country-1 and Country-2, I need to show the list of states only belonging to Country 1 and 2. Not the default list of 50 US states.

Since all these states are updated in Salesforce, What I want to check is, is there a way that we can sync the state values from Salesforce to the Values highlighted in the screenshot in real time so that the manual effort of updating is reduced?

I understand that there's no out of the box solution for this in Marketo. One of the alternatives that was explored is as follows:

Create a global form in Design Studio and have the values for that form updated manually each time and reference that form every where required.

Limitation: even though it's a one time activity, maintenance could be an issue. One should manually update to keep the list current.


is there a way to get the list of states from Salesforce and show in the "Values" in state field so that visibility rules can be defined accordingly?

Vikram Ramesh
Level 10 - Community Moderator

Re: Getting states of other countries to a Marketo form

You can't just add them to the main Values list: they also need to be added to the VR sections (which are different parts of the form descriptor).


You could - in theory - have a scheduled webhook that, running in the context of a dummy lead, calls the SFDC Tooling API endpoint to get the values, and writes the JSON response to a Marketo {{my.token}} using the Marketo REST API. (Or you could schedule the same thing with a 3rd-party scheduler, it's just handy to use the Smart Campaign scheduler.)


Then output that {{my.token}} into a <script> block and merge the entries with the live form. 


A dev with experience in all these areas could definitely code it up, but would it be worth it... I dunno.