Use Javascript to distinguish old and new Form Instance.

Understand how to distinguish between old and new form instance using a Javascript.

Last published at: April 9th, 2026

This document explains how to programmatically determine whether a form submission is the initial (new) or a subsequent (existing) interaction within an automated workflow.

The mechanism.

To distinguish between new and existing form instances, the event scripts use a built-in JavaScript variable named “isInitialFormSubmit”. This variable functions as a boolean flag to monitor the form's lifecycle across various routing scenarios.

How to configure.

Navigate to Forms - Definitions menu option. Create a form definition and open it in the designer mode. Drag and drop a text box and a submit button. Click the Page - Functions. 

 

The page event configuration pop-up appears as shown below. Create a new function named “form_load()” and add any scripts to run when the form loads. Click the “Validate Script” button to ensure the data meets specific criteria before processing. Click the “Save” button. 

 

Navigate to the Process - Definitions menu option. Create a Process Definition using the “InstantiateForm” process step. This step creates a Form Instance. Edit the step to configure the “Required” parameters. Provide a step name, select the form definition from the drop-down list, and provide a variable or global reference to hold the form instance ID.  

 

Edit the step to configure the “Optional” parameters. Provide a custom name for the form instance (if necessary). Select “Yes” to use the same form or “No” to create a new form instance in a loop. 

 

Tested Scenarios and Variable Behavior.

The document details how isInitialFormSubmit behaves under different workflow configurations:

  • Public Forms: The variable remains true for every submission.
  • Multiple Users (Same Route): The variable is true only for the first user on that route and remains false for subsequent users on that route.
  • Initiated & Routed Forms:
    • If "Use the same form" is enabled, the variable is true for the first form instance but becomes false for all remaining instances, including those inside a loop.
    • Manual Setting: If the logic dictates a specific route flow, the variable is true for the first route ("Route 1") and false for all subsequent routes.


Workflow Visual Analysis.

Refer to the above process diagram that illustrates a typical logic flow where these variables are applied:

  1. Start & Instantiate: The process begins by creating a form instance.
  2. Routing: The form moves through the Route Form.
  3. Iterative Logic: The flow enters a For Loop and a Decision diamond.
    1. According to the text, if these routes use the "same form" setting, only the very first step in this chain would register isInitialFormSubmit as true.
  4. Completion: The process ends once the loop requirements are met at the final placeholder.