SOLVED

Using Program Tokens in External Links for Form Submissions

Go to solution
agiordano-mcl
Level 1

Using Program Tokens in External Links for Form Submissions

I'm trying to us an external URL as the confirmation for a form submission, and I'm trying to both retrieve and push some values in the URL to another page on Submit (if that makes any sense at all).  Reason being, we have an external agency helping us out with some sales calls.  We have to keep track of which sales agent leads to which conversions, and I'm trying to push a Customer ID number in the URL so that the sales agents won't have the opportunity to fat-finger it potentially.

 

The sales agent will have access to the landing page with the form that I supply to them, the customer's first name, last name, and email (and obviously phone), and that's it.  We're still unsure if we'll also be passing along the customer ID numbers.  But at the least, the customer ID numbers are stored in Marketo (which the sales agents won't have access to).

The idea is to then, on form submission, link to an external URL and push within the URL some UTMs as well as the values on the form, and retrieve and push the Customer ID number. 


My URL structure is: https://mywebsite.com/?email={lead.Email}&CustomerID={lead.CustomerID}&utm_source=form&{lead.AgentNu... and I've put that into the External URL box on form submission as {my.SubmissionURL}

I can't figure out the syntax for the onSubmit java JavaScript function, though, to retrieve and pass the values I need (if possible), and I'm not even quite sure where the extra JavaScript goes (in the embed script for the form to go on a landing page?).

Here's what I'm trying to work with:

MktoForms2.loadForm("//app-ab00.marketo.com", "785-UHP-775", 1057, function(form) {

form.onSubmit(function(){
// Get the form field values
var vals = form.vals(NOT SURE WHAT TO PUT HERE OR WHAT SYNTAX TO USE);

alert("Submitted values: " + JSON.stringify(vals)); //not sure what this line means, but it was in the Forms 2.0 documentation
});
});

Any help figuring this out would be great!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Using Program Tokens in External Links for Form Submissions

This post shows how to append form fields to the Thank You URL:

 

Appending form fields to the Thank You URL

 

Not sure why you want to use a {{my.token}} for anything. That isn’t necessary unless you’re doing different things per-program. As I mentioned, would need to know your browser support list to know whether a {{my.token}} could be used natively as a template (JS template literal) or not.

View solution in original post

6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Using Program Tokens in External Links for Form Submissions


My URL structure is: https://mywebsite.com/?email={lead.Email}&CustomerID={lead.CustomerID}&utm_source=form&{lead.AgentNu... and I've put that into the External URL box on form submission as {my.SubmissionURL}

That certainly will not work. It doesn’t even use a standard token syntax (neither Marketo {{lead.token}} syntax nor JS ${template.variable} syntax).

 

But even if it used {{lead.token}} syntax, it wouldn’t work in the External URL, because you’d just be hard-coding the value. Token syntax doesn’t matter if the string doesn’t get passed though a token parser at some point!

 

Let me ask you this before continuing: what is the official browser support list at your company?

agiordano-mcl
Level 1

Re: Using Program Tokens in External Links for Form Submissions

@SanfordWhiteman that is a great question...
I'm not sure that we have one.  Typically we use Chrome?

Java is not something I'm super familiar with, so I'm open to any and all suggestions for potentially making this work.  Even if it means adding another landing page or something in the mix.

SanfordWhiteman
Level 10 - Community Moderator

Re: Using Program Tokens in External Links for Form Submissions

It's easily done with JS on the LP. It's even easier to do if you don't support IE 11. That's why I was asking about the support list.
agiordano-mcl
Level 1

Re: Using Program Tokens in External Links for Form Submissions

JS on the landing page sounds like what I was thinking.  But I couldn't figure out how to define the variables for an onSubmit handler.  If there are any support docs you might recommend, other than the main page (which wasn't entirely helpful to me), I'm all ears/eyes!

SanfordWhiteman
Level 10 - Community Moderator

Re: Using Program Tokens in External Links for Form Submissions

This post shows how to append form fields to the Thank You URL:

 

Appending form fields to the Thank You URL

 

Not sure why you want to use a {{my.token}} for anything. That isn’t necessary unless you’re doing different things per-program. As I mentioned, would need to know your browser support list to know whether a {{my.token}} could be used natively as a template (JS template literal) or not.

Phillip_Wild
Level 10

Re: Using Program Tokens in External Links for Form Submissions

To clarify, do you wish to notify an external group of users that a form submission has taken place in Marketo? If so, you could use something like a Call Webhook step triggered off form submission. That would then send a notification / update a Google Sheet / that sort of thing (either via some dev help or via middleware such as Zapier). That might avoid the Javascript bit if you're not comfortable.

 

Otherwise, as Sanford said, the External URL option isn't relevant, you would have to submit the background form submit using pure Javascript.