Execute Script in Automation
Usage Instructions
The automation will execute JS code in the step using the script engine
Usage Instructions
The code snippets running in automation can use all functions in Script, and additionally extend the automation-specific automatic context object
getVar
Get automation context variables
| Parameter | Type | Description |
|---|---|---|
| varName | String | Context variable name |
automatic.getVar(varName);Usage Example
const varList = automatic.getVar("varList");Notes
If the variable name to be obtained does not exist in the context, a null value will be returned
setVar
Set automation context variables
| Parameter | Type | Description |
|---|---|---|
| varName | String | Context variable name |
| value | Object | Variable value |
automatic.setVar(varName, value);Notes
If the variable name to be set exists in the context, it will overwrite the existing variable value
setProgress
Set the execution progress of the current automation
| Parameter | Type | Description |
|---|---|---|
| progress | Double | Execution progress, range 0~100 |
| message | String | Progress description text |
automatic.setProgress(50.56, "Processing files");setReturnValue
Set the return value of the current automation. This function has the same capability as the Set Automation Return Value step
| Parameter | Type | Description |
|---|---|---|
| returnValue | Object | Automation return value |
automatic.setReturnValue(1);
automatic.setReturnValue(true);
automatic.setReturnValue(new Date());
automatic.setReturnValue({
name: "张三",
});
automatic.setReturnValue([1, 2, 3, 4, 5, 6]);Notes
When multiple automatic.setReturnValue are used, only the last call will take effect; so if multiple values need to be returned, a data structure needs to be built in the code snippet and returned as a whole

