formScope
(FintechOS Studio 20.1.3 and later)
The functionality of this object overlaps with formData.formScope. It is recommended to use formData.formScope instead.
Object shared between different JavaScript attributes of an entity form, used for storing user defined variables and functions.
Availability
| Entity | Attributes |
|---|---|
| Entity form | Before events, after events. |
| Entity form section | After events. |
| Entity form section (wizard mode) | Before section save, After section save. |
| Entity form field | Attribute change event. |
It is also a property of formData, so it can also be used on an EntityView afterGenerate attribute.
Examples
In this example, we track the duration in milliseconds between the time when a form is opened and the time the final form step (the Thank You screen) is displayed.
In the first form step's afterGenerate.js script, we define a formScope attribute called start that holds the current time:
formScope.start = new Date();
In the last form step's afterGenerate.js script, we save the duration in milliseconds passed since the first form step was opened in the elapsedTime attribute of the current record.
formData.model['elapsedTime'] = (new Date() - formScope.start);
For details on how to access the current record's attribute values, see formData.model.