Page Properties | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Ressourcesyuuvis® RAD - Client-side Form Scripting (parts will be taken over and be available with the next version 2.3 RemarksMartin B. is working on it together with Manuel and Stevan ... |
...
Section | ||||||
---|---|---|---|---|---|---|
| ||||||
|
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. |
...
Main part(s)
Subsection(s)
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
Code Block | ||||||
---|---|---|---|---|---|---|
|
...
if( |
...
|
...
scope.situation = |
...
= 'SEARCH' ) return; // other situation values are EDIT and CREATE
// ... additional script code |
Info | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||
Read on
|