To enhance basic workflow functionality, server-side scripts can be used in workflow blocks. In addition Server-Side API classes, the following three can be used workflow scripts:
current
scratchpad
activity
The current object is a instance, for which a workflow context has been created. The property names of the current object match the names of the record columns (Column Name attribute).
The scratchpad object is an associative array (JSON), you can place values to use them within the context later. The value of the object is stored in the scratchpad field of the Workflow Context.
The activity object is a instance of the current block record. The activity object properties match the names of record columns (Column Name attribute) in the Workflow Executing Activity (wf_executing_activity) table.
Global objects in a workflow
Below is a workflow example for the Task ( table.
In the beginning of the process, a Task (task) child record is created through the Create Child Task block. Then the process is stopped on 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 use sampling from the Task table by 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();
}