If you configure custom forms for objects, you can additionally use executable scripts to e.g. validate data, change data, change field properties - such as read-only or to be mandatory - and show context-related messages. Form related scripts enhance your options by adding further functionalities to support your use cases and processes the best.
Table of Contents
Introduction
In yuuvis® Momentum client, you can use executable scripts to:
- validate data
- change data, for example by calculating a value based on other values
- change field properties, such as read-only and visibility
- show context-related messages.
Some things to note about script properties:
- Client scripts in yuuvis® Momentum architect are written in JavaScript (ECMAScript).
- Client scripts execute in the user's browser using the browser's native JavaScript runtime.
- You can define client scripts by object type and form situation.
Note: When field data changes are made using a script (i.e., without user action) when loading the form, the Save option is not available. In contrast, you can disable fields to protect against user changes.
Script Scope
The relevant object is given to each client script under the name 'scope.' This object provides the API so the scripts can access the object fields and their properties.
Properties of 'scope'
Name | Description |
---|---|
api | Supplies access to the plug-in API, with 'session' (user information), 'dms' (object details, search via DMS-Service), 'http' (connection to any service), 'config', 'util' (helper functions) and 'agent' properties. |
data | Supplies all object fields defined in the object or process activity. The fields offer read-only access using the technical name. Available for release 2017-09-27 (3.22.x) or later. |
model | Supplies the flattened form model and all object fields defined on the form. The fields can be accessed with the technical name. The form groups cannot be accessed in this way. |
situation | Supplies the current form model situation. Scripts can respond to the relevant situation. Possible values are 'CREATE' (create), 'SEARCH' (search) and 'EDIT' (edit index data). |
objectId | Supplies the ID of the current DMS object if available (available since version 6.4). |
scope.data
Even when not defined in the form (object forms as well as process task forms), you can access object field data or process variables by using this part of the scope. Use the technical name of the object type field or process model variable to read its value, as shown in the following example.
Check situation
1 |
|
scope.situation
For object types, you can create a default form to be used for the situations CREATE, EDIT and SEARCH. In each situation, any included scripts are active.
If a general form is used, but different data management is necessary, it is possible to check which situation is given.
For example, how to deactivate a form script to be used in the situation 'SEARCH.'
Check situation