Altova RecordsManager

Scripts in entry forms enable you to update fields of a record and, in some cases, to execute an action such as sending emails. Scripts can be executed in the following situations:

 

1.Script on record save: The script is used to modify other field values of the record and/or to send emails. The entry point for defining the script is a check box near the top of the entry form (framed red in screenshot below).

2.Script on editing any field of a record: When any field of a record is edited, the script modifies one or more other fields of the modified record. The entry point for defining the script is a check box near the top of the entry form (framed red in screenshot below).

3.Script on editing a specific field: When a specific field of a record is edited, the script modifies one or more other fields of the record.

4.Script behind buttons: When a button is clicked, its script can modify field values of the record.

5.Script when a child record changes: When a record changes, a script in the parent component can change data in the parent record.

6.Script on record load or form change by user: This script is triggered each time a record is loaded or when a record is changed by the user.

Click to expand/collapse

Given below are descriptions of how to create scripts for each of these scenarios.

 

Creating, removing, and editing scripts

For each type of script listed above, the entry point is a check box. Select the check box to create the script. Deselect the check box to remove the script. After a script has been created, click its Edit icon (see screenshot above) to modify the script.

 

Undo actions revert all script actions

If a user chooses to undo an action after a script has been executed, then all the actions of that script are reverted, regardless of whether the actions created, modified, or deleted a record.

 

The actions of a script

In a script, you can set up one or more actions.

Click to expand/collapse

The kind of actions (for example, updating fields or sending emails) depends on the type of script. For each type of script listed below the available actions are listed.

In a script, each action is listed below the action that was added previously.

The actions of the script will be executed in the order in which they are listed.

The Save action is automatically always added as the last action of the script.

If you wish to change the execution order, you can reorder the actions by clicking the Move Up/Down icon next to the action you want to move (first icon from the right in screenshot above). Note that the Move Up/Down icon appears on actions only after a second action has been added to the list. The Move Up/Down icon does not appear on Save actions because this type of action must always be the last action of the script.

On clicking the Move Up/Down icon, (i) all of that action's icons are replaced by one X icon and (ii) all the icons of each of the other actions are replaced by one arrow that points either up or down (see screenshot below). Now if you click one of these arrows, the originally selected action (indicated by X) will be inserted either above the action whose arrow you have just clicked or below it, according to the direction of the arrow. In the screenshot below, for example, the Send Email action can be moved to either the first or third position in the sequence.

Click to expand/collapse

 

1. Script on saving a record

Defined via:

Check box near top of entry form: Script on Record Save

Script triggered:

When a record is saved

Script actions:

(i) Modifies fields of the record to save; (ii) Sends emails; (iii) Creates ancestor and child records; (iv) Modifies/deletes child records

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Edit other records (for any data table) or modify/delete child records; (iv) Fetch records; (v) Add emails

 

In each script of this kind, you can: (i) specify the fields to update and their values (Add field update); (ii) set up conditions for the update (Add branch); (iii) create child records or records for any data table, or modify and delete child records (Edit other records); and (iii) send an email to selected recipients (Add email). You can choose each option multiple times. The screenshot below shows the script's form after actions have been added to it for sending emails and for updating a field.

Click to expand/collapse

You can add the following actions to the script.

 

 

 

2. Script on editing any field of a record

Defined via:

Check box near top of entry form: Script on Any Edit in This Form

Script triggered:

When any field of a record is edited

Script actions:

Modifies fields of the edited record

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Fetch records

 

These scripts enable you to: (i) specify the fields to update and their values (Add field update) and (ii) set up conditions for the update (Add branch). You can choose both options multiple times. If the field that is being edited by the user has its own script (see Script Type 3 below), then that script will be executed before this script—which means that if both scripts update the same field, then this script will overwrite any previously updated value of the target field.

Click to expand/collapse

You can add the following mechanisms to the script.

 

 

3. Script on editing a specific field of a record

Defined where:

As a property of a field

Script triggered:

When this specific field is edited

Script actions:

(i) Modifies other fields of the record containing the edited field; (ii) Creates ancestor and child records; (iii) Modifies/deletes child records

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Add other records (for any data table) or modify/delete child records; (iv) Fetch records

 

This type of script is defined on a field as one of the field's properties at the time when the field is created in the entry form. the script enables you to: (i) specify the fields to update and their values (Add field update); (ii) set up conditions for the update (Add branch); and (iii) create child records or records for any data table, or modify and delete child records (Edit other records). Any of these options can be chosen multiple times. Note that if another script is defined that will be executed on any edit in the form, then that script would overwrite the update of this script if they both update the same field (see Script Type 2 above).

Click to expand/collapse

You can add the following mechanisms to the script.

 

 

4. Script on clicking a button

Defined where:

As a property of a button

Script triggered:

When the button is clicked

Script actions:

(i) Modifies fields of the record to save; (ii) Creates ancestor and child records; (iii) Modify/delete child records; (iv) Sends emails; (v) Displays messages

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Save record;
(iv) Add other records (for any data table) or modify/delete child records;
(v) Fetch records; (vi) Add emails; (vii) Add message

 

Scripts of this type are executed when a button of an entry form is clicked. The script enables you to: (i) specify the fields to update and their values (Add field update); (ii) set up conditions for the update (Add branch); (iii) save the record (Save record); (iv) create ancestor records and child records, or modify and delete child records (Edit other records); (v) send an email to selected recipients (Add email); and (vi) display a message (Add message). Each option, except Save record, can be used multiple times.

Click to expand/collapse

You can add the following mechanisms to the script:

 

 

5. Script on editing a child record

Defined where:

As a property of the Child Rows entry of a data table (that has a child data table)

Script triggered:

When a child row of the data table is edited

Script actions:

Modifies fields of the record containing the edited child record

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Fetch records

 

This kind of script is available in data tables that have child rows. In the entry form of such a data table, you can add child rows to a table cell of the entry form. In the definition of Child Rows, select the Allow editng <Child> records option (screenshot below) and select an entry form of the child data table. You can now define a script of the current data table that will be executed when the child record is edited (framed red below).

Click to expand/collapse

In this kind of script, you can: (i) specify the fields to update and their values (Add field update) and (ii) set up conditions for the update (Add branch). Both options can be chosen multiple times.

 

 

6. Script on record load or form change

Defined where:

Check box near top of entry form: Script on Record Load or Form Change

Script triggered:

Each time a record is loaded or the entry form is changed

Script actions:

(i) Updates fields of the record; (ii) adds conditions; (iii) edits other records; (iv) fetches records

Mechanisms:

(i) Add field updates; (ii) Add conditions (or branches); (iii) Edit other records (for any data table) or modify/delete child records; (iv) Fetch records

 

This type of script is defined for the entry form and it is triggered each time a record is loaded or when the form is changed by the user.The script is also executed for child records, but it is executed only once, when the record is loaded. This means that the script is executed when the record is loaded. It is also executed when a child record is loaded. Returning to a child record will not cause script execution. For this to now happen, the main record will have to be changed.

 

It is the primary way to prepare data (by using the Fetch Records mechanism) for use in the form. Additionally, you can update fields directly a record is loaded (by using Add field update). Such updates can also be made conditional (by placing them in a condition added by the Add branch mechanism).

Click to expand/collapse

You can add the following mechanisms to the script.

 

 

© 2018-2024 Altova GmbH