When GlobalForms submissions are processed in a GlobalCapture workflow, the same form can be opened at different validation steps. You can show different components at each step. For example, a purchase order form can show the request fields when it is first filled in, and add a Signature component for the approver when it reaches the Approval step.
This page applies to forms imported into GlobalCapture with a GlobalCapture import node. See Importing Submissions with a GlobalCapture Import Node.
How it works
When a submission is opened from a GlobalCapture validation step, the name of that step is available to scripts as submission.metadata.Node. A new submission that hasn't reached GlobalCapture yet has no step name.
The simplest approach is to copy the step name into a hidden component, then use ordinary simple conditions to show or hide components based on it.
Step 1: Store the current step
-
Add a Text Field named, for example, Current Step (
currentStep). On its Display tab, select Hidden. -
On its Data tab, select Current Node. GlobalForms fills the field with the validation step name, or leaves it blank when the form isn't in a workflow step.
-
On the same component, turn off Clear Value When Hidden, so the value is kept even though the component is hidden.
-
Save the component.
To use your own value when the form isn't in a step yet, leave Current Node unselected and instead enter this under Calculated Value → JavaScript Value:
// Use the GlobalCapture validation step name, or 'New' if the form isn't in a workflow step yet.
var step = submission && submission.metadata && submission.metadata.Node;
value = step || 'New';
Step 2: Show components by step
On each component that should appear only at a certain step, for example the approver's Signature:
-
Open its Conditional tab and set Property to Visible.
-
Under Simple, set This component should be displayed to True, When the form component to Current Step (currentStep), and Has the value to the step name exactly as it appears in GlobalCapture, for example
Approval.
To show a component at several steps, use an advanced condition instead:
show = ['Approval', 'Final Review'].indexOf(data.currentStep) !== -1;
When a component is hidden, its value is cleared unless Clear Value When Hidden is turned off. Turn it off on components that hold data from earlier steps, or that data is removed when the form moves to a step where they're hidden.
Tips
-
Step names must match exactly, including upper and lower case and spaces. If GlobalCapture steps are renamed, update the conditions.
-
To check the step name while testing, temporarily untick Hidden on Current Step and open the submission from GlobalCapture.
-
Showing or hiding components controls what users see. To control who can act at each step, use GlobalCapture's validation node security.