Copy Submitted Data to New Form

In this template, the data from a submitted Form is copied over to a new Form with a different template (Target Form).

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

var form2 = {};
var target = Query.select(“Forms.templates”, “id”, “name=’Target Form'”);
if (target == null) return 1;
form2.templateid = target[0].id;
form2.status = 0;
form2.name = Forms.getNewName(form2.templateid);
form2.owner = User.getName();
form2.date = Date.now();
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;

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

Copy Submitted Data to New Form (Source)
Target Form

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s