SOLVED

Re: How can I make a Unique ID per email?

Go to solution
Anonymous
Not applicable

How can I make a Unique ID per email?

I need to create a unique ID for each time a lead has filled out a form on that specific inquiry.

since the customer does not use SF I need to find a way to create without Sales force.

I was trying to combine the Date or time with the Marketo Unique code token

but when I combine with date there is a - and I don`t want a - in between the codes.  when I use time there is a : in-between the numbers....

Is there a way to generate the date without the - or spaces or the time without the :

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: How can I make a Unique ID per email?

This is very simple.  No reason to generate anything on the server, just generate a timestamp in the browser when the form posts.

MktoForms2.whenReady(function(form){
  form.onSubmit(function(form){
    form.addHiddenFields({ lastFormPostUniqueId : new Date().getTime() });
  });
});

 

(and of course create lastFormPostUniqueId as a custom field in Marketo)

 

getTime() is epoch time in milliseconds.  No non-malicious lead can post twice in the same millisecond (and since you can append the lead's Marketo Unique Code the final value of lastFormPostUniqueId will be unique to that user).

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: How can I make a Unique ID per email?

This is very simple.  No reason to generate anything on the server, just generate a timestamp in the browser when the form posts.

MktoForms2.whenReady(function(form){
  form.onSubmit(function(form){
    form.addHiddenFields({ lastFormPostUniqueId : new Date().getTime() });
  });
});

 

(and of course create lastFormPostUniqueId as a custom field in Marketo)

 

getTime() is epoch time in milliseconds.  No non-malicious lead can post twice in the same millisecond (and since you can append the lead's Marketo Unique Code the final value of lastFormPostUniqueId will be unique to that user).

Anonymous
Not applicable

Re: How can I make a Unique ID per email?

Thank You Sanford!,

You`have it solved my problem

ZachRogers
Level 1

Re: How can I make a Unique ID per email?

Hi Sanford,

 

We have a seemingly similar situation where we're building a Website Login/Registration process using Marketo forms.

 

We need to essentially dual-post and pass back to Drupal the Marketo Unique ID and the Time of Registration (which you've provided here) so that other internal systems can work on matching and other requirements to identify the user.

 

We're struggling to understand how to retrieve the Marketo Unique ID to put in that callback to Drupal. 

SanfordWhiteman
Level 10 - Community Moderator

Re: How can I make a Unique ID per email?

It'll be part of the values object passed to a success listener:

MktoForms2.whenReady(function(mktoForm){
  form.onSuccess(function(submittedValues,thankYouURL){
    // submittedValues.lastFormPostUniqueId is usable here
    return false;
  });
});