How to get a lead id on sccess event

Anonymous
Not applicable

How to get a lead id on sccess event

Get lead id on success event of marketo form

<script>
MktoForms2.loadForm("//app-sj07.marketo.com", "11-11-11", 12, function(form) {
  // Add an onSubmit handler
  form.onSuccess(function(){
  // Get the form field values
  var vals = form.vals();
  alert("Submitted values: " + JSON.stringify(vals));
  });
  });
</script>

Tags (1)
2 REPLIES 2
Grégoire_Miche2
Level 10

Re: How to get a lead id on sccess event

Hi Mayank,

Place the {{lead.ID}} token in your page, in a hidden position, then use Javascript to collect the value and pass it to your script.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: How to get a lead id on sccess event

Is this a question or a statement?  Obviously, your code does not work. Unfortunately, Greg's pointer won't work reliably either.  I've explained this in other posts.  Please search for them and/or provide more explanation in your questions.