SOLVED

Prepopulating form fields with details from lead's record

Go to solution
Bogdan_Moisa
Level 2

Prepopulating form fields with details from lead's record

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 

1 ACCEPTED SOLUTION

Accepted Solutions
Jay_Jiang
Level 10

Re: Prepopulating form fields with details from lead's record

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

View solution in original post

3 REPLIES 3
Jay_Jiang
Level 10

Re: Prepopulating form fields with details from lead's record

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
Level 10 - Community Moderator

Re: Prepopulating form fields with details from lead's record

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

Bogdan_Moisa
Level 2

Re: Prepopulating form fields with details from lead's record

Sorry for the late reply, but this worked perfectly.

Much appreciated! 

Thanks to Sanford as well.