Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Page Properties
hiddentrue

Status

Status
colourRed
titleSTUB

Priority2.3
NoteMartin / Manuel / Stevan

Ressources

yuuvis® RAD - Client-side Form Scripting (parts will be taken over and be available with the next version 2.3

Remarks

Martin B. is working on it together with Manuel and Stevan ...

...

Section
bordertrue


Column

Table of Contents

Table of Contents
exclude(Table of Contents|Read on|Another Tutorial|Another Concept Article|Another interesting Tutorial)


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

apiSupplies 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)

dataSupplies 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.
modelSupplies 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).

objectIdSupplies 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
2
3

if (scope.data.status) {            // only fields not NULL are in the data object, so check for existence
    if (scope.data.status == 'active') { ... }
}

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
languagejava
titleFor Loop in Java (brief, concise title)
linenumberstrue

...

if(

...

 

...

scope.situation =

...

= 'SEARCH' ) return;      // other situation values are EDIT and CREATE
// ... additional script code


Info
iconfalse

Read on

Section


Column
width25%

Another Tutorial

Brief summary of the article linked.


Column
width25%

Another Concept Article

Brief summary of the article linked.


Column
width25%

Another interesting Tutorial

Brief summary of the article linked.