Make a Marketo Form Submission in the Background

September 25, 2015 | by

When your organization has many different platforms for hosting web content and customer data it becomes fairly common to need parallel submissions from a form so that the resulting data can be gathered in separate platforms. There are several strategies to do this, but the best one is often the simplest: Using the Forms 2 API to submit a hidden Marketo form. This will work with any new Marketo Form, but ideally you should create an empty form for this, which has no fields:

Empty Form

This will ensure that the form doesn’t load any more data than necessary, since we don’t need to render anything. Now just grab the embed code from your form and add it to the body of your desired page, making a small modification. Your embed code includes a form element like this:

You’ll want to add ‘style=”display:none”‘ to the element so it is not visible, like this:

Once the form is embedded and hidden, the code to submit the form is really quite simple:

Forms submitted this way will behave exactly like if the lead had filled out and submitted a visible form. Triggering the submission will vary between implementations since each one will have a different action to prompt it, but you can make it occur on basically any action. The important part is setting your fields and values correctly. Be sure to use the SOAP API name of your fields which you can find with Export Field Names to ensure correct submission of values.

Migrating from Munchkin Associate Lead

Background form submission is one of the recommended replacement methods for Munchkin Associate Lead.  The sample HTML page below demonstrates migration at a high level, by reusing the same values which are submitted to Associate Lead.