How can I make a Unique ID per email? | Community
Skip to main content
August 3, 2015
Solved

How can I make a Unique ID per email?

  • August 3, 2015
  • 1 reply
  • 4200 views

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 :

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 SanfordWhiteman

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).

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
August 5, 2015

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).

August 5, 2015

Thank You Sanford!,

You`have it solved my problem