In addition Server-Side API classes, you can use the following global objects
current
scratchpad
activity
The current object i instance, for which a workflow context created. The property names of the current object are the same as the names of the record columns (Column Name attribute).
The scratchpad object is an associative array (JSON), you can place values to use . The value of the object is stored in the atchpad field of the Workflow C
The activity object instance of the current block record. The properties of the activity object are the same as the names of record columns (Column name attribute) in the Workflow Executing Activity (wf_executing_activity) table.
Global objects in a workflow
The following example is the workflow for the Task ( table.
he beginning of the process, a child Task record is created through the Create Child Task block. Then the process stops at the block to wait n Progress state.
After the state is changed to In Progress, the process proceeds to the Update Child Task block, the Task child record is
The block is used to create a Task record according to its settings. The ID of the current record is specified in its Parent field:
new_task.parent_id = current.sys_id;
To update a r you need to know its ID. However, the block does not return the ID of the created record.
To search for the created Wf Executing Activity field.
object to record the ID value of the block:
const curentExecActivityId = activity.sys_id;
scratchpad.recGeneratorActivityId = curentExecActivityId;
The block named Update Child Task searches for the Task record and updates it:
const task = new SimpleRecord('task');
task.get('wf_executing_activity', scratchpad.recGeneratorActivityId);
if (task.sys_id) {
task.state = '3'; // In Progress
task.update();
}