Duplicate Form with new date in xx days

In this template, the data from a submitted Form is copied over to a new Form with the same template and a new date in 7 days.

The Javascript code entered in the Execute on Submit field in the Form template Properties is as follows:

var form2 = {};
form2.templateid = form.templateid;
form2.status = 0;
form2.name = Forms.getNewName(form2.templateid);
form2.owner = User.getName();
form2.date = Date.today(7);
form2.geo = Settings.getLocation();
form2.address = Settings.getAddress(form.geo);
form2.linkedtable = form.linkedtable;
form2.linkedid = form.linkedid;

var values2 = {};
values2.F1 = F1;
values2.F2 = F2;
values2.F3 = F3;
form2.value = JSON.stringify(values2);

Query.insert(“Forms.forms”, form2);

return 1;

Change the value 7 in Date.today(7) to the number of days from Today you want for the new form date.
Change the values F1, F2, etc.. to the field IDs in your own template.

Download and Import the sample template to the Templates section of the Forms app in your web account:

Duplicate Form with new date in 7 days


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s