A lot of companies make use of strict validation on country and state values within their CRM system. What this usually entails is for some countries like the United States and Canada, only specific province or state values are allowed. For the majority of other countries however, any value is accepted. When this validation is in place, if the country or state value for a lead in Marketo is not one of the accepted values within the CRM, then the lead will fail to sync. This will prevent leads from syncing on creation, or will block all field updates from syncing.

There are a few ways to get around this working with native Marketo functionality, but each of them have drawbacks or limitations. By using a data cleansing pre-sync program, or washing machine, it is possible to handle expected value cleaning like changing ‘NY’ to ‘New York’. The washing machine is limited however, since it can only handle steps that were manually setup, so any unexpected input will not get cleaned. The way around that is to blank or erase unexpected input as a final step catchall, but this means losing region data for prospects.

Using Marketo’s native forms 2.0 functionality, we can setup the state picklist to display sets of values based on which country is selected. This works great for the countries that have validation on their state values. The downside to this solution is that the state field will not appear if any of the other country values are selected, so we will only be capturing state values for a subset of countries.

We need to use custom javascript on the base Marketo form in order to allow for state values to be entered for countries with no validation, while those with validation only have preset values available for selection. With javascript, we are able to build out the mapping of each group of acceptable state values to selected country. Any time one of those specific countries is selected, only the acceptable state values are given as options within the picklist. If a country without a mapped list of states is selected instead, we use the javascript to switch the state’s picklist field into an open text field. We are also able to seamlessly tie into Marketo’s form validation, so you don’t lose any other field requirements that were built directly into the Marketo form.

By using a combination of Marketo forms with custom javascript and a washing machine, you can ensure that you are capturing accurate region data from visitors that matches what your CRM system expects.