System token in Form 2.0 | Community
Skip to main content
July 25, 2014
Solved

System token in Form 2.0

  • July 25, 2014
  • 5 replies
  • 3422 views
Hi,

I'm currently setting up a referral program and need to populate a hidden field with the date the form gets submitted. Is it possible to use system tokens in the forms to do that?
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
Hi Anissa - Don't think about putting the date in the form, but rather create a smart campaign. When Form is Submitted, then change the last submitted date field to {{system.dateTime}}

Make sense?

5 replies

New Participant
August 22, 2014
Got it. Thanks Adam W!
August 21, 2014
Hmm. No. Don't embed it in a hidden field. Write a smart campaign that says, when this form is submitted, THEN in the flow step, change FIELD NAME to {{system.dateTime}}
April 18, 2017

Adam - curious to know why we can't just embed it, seems easier but doesn't work!

SanfordWhiteman
New Participant
April 18, 2017

Don't know what Adam was getting at, save for the fact that the token won't work on non-Marketo pages.

You can -- and, in my opinion, should -- add the timestamp in the browser. The less your server has to do, the better.

MktoForms2.whenReady(function(form){

    form.onSubmit(function(form){

      form.addHiddenFields({

            "lastFormSubmit" : new Date().toISOString()

        });

  });

});

Of course "lastFormSubmit" should be replaced with the name of the field in your instance.

The only liability -- if you can call it that -- is that a malicious person could forge the submission date, while in the flow it'll always stamp the real date. Why that hack, of all things, would be what bad guy would choose to do escapes me.

New Participant
August 21, 2014

Hello.

I'm embedded a forms 2.0 form on my website and {{system.dateTime}} as a hidden field isn't working. In Marketo, instead of showing the date/time stamp, it shows "{{system.dateTime}}". 

Any ideas as to why and how to fix?

July 25, 2014
Makes sense :) Thanks, Adam!
Accepted solution
July 25, 2014
Hi Anissa - Don't think about putting the date in the form, but rather create a smart campaign. When Form is Submitted, then change the last submitted date field to {{system.dateTime}}

Make sense?