Prepopulating form fields with details from lead's record | Community
Skip to main content
Bogdan_Moisa
New Participant
June 18, 2019
Solved

Prepopulating form fields with details from lead's record

  • June 18, 2019
  • 1 reply
  • 2681 views

Hello! 

We have the following setup for a campaign.

- User completes a form requesting a license

- Admin checks if the user meets the requirements and then uses a form to approves/refuse the applicant. 

The admins have to enter the applicant's email address in the form and they have asked if there's a way to have the field pre-populated with the applicant's email. 

The forms are on two different landing pages. 

Is this possible using Marketo? I imagine there will be some coding involved...

Any help will be appreciated. 

Best, 

Bogdan 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jay_Jiang

I'm assuming your workflow is something like this:

Prospect fills out customer facing form on landing page A

Marketo trigger smart campaign sends alert to Admin with a link to internal form on landing page B

Admin fills out internal form with person's details

in your alert email append tokens to URL parameters (make sure the URL parameters match the form fields' IDs) e.g. https://cname.domain.com/internal_form?FirstName={{lead.First Name}}&Email={{lead.Email Address}}

and on landing page B, add javascript to get url parameter values and pre-fill the form

something like this:

MktoForms2.whenReady(function(form){
var vals = form.vals();
var url = new URL(window.location);
var fieldsObj = {};
MktoForms2.$.each(vals, function(key,val){
if(url.searchParams.get(key)){fieldsObj[key]=url.searchParams.get(key)}
});
form.vals(fieldsObj);
});

Since this script is for an internal landing page, make sure your staff are using the latest modern browsers - hopefully something within your control

1 reply

Jay_Jiang
Jay_JiangAccepted solution
New Participant
June 19, 2019

I'm assuming your workflow is something like this:

Prospect fills out customer facing form on landing page A

Marketo trigger smart campaign sends alert to Admin with a link to internal form on landing page B

Admin fills out internal form with person's details

in your alert email append tokens to URL parameters (make sure the URL parameters match the form fields' IDs) e.g. https://cname.domain.com/internal_form?FirstName={{lead.First Name}}&Email={{lead.Email Address}}

and on landing page B, add javascript to get url parameter values and pre-fill the form

something like this:

MktoForms2.whenReady(function(form){
var vals = form.vals();
var url = new URL(window.location);
var fieldsObj = {};
MktoForms2.$.each(vals, function(key,val){
if(url.searchParams.get(key)){fieldsObj[key]=url.searchParams.get(key)}
});
form.vals(fieldsObj);
});

Since this script is for an internal landing page, make sure your staff are using the latest modern browsers - hopefully something within your control

SanfordWhiteman
New Participant
June 19, 2019

Don't forget to remove the mkt_tok as this is supposed to be a Referral Form equivalent.