This method copies the workflow with creating a version in the Checked Out state and after that returns a copied workflow.
Return:
Type
Description
SimpleRecord object or NULL
This method returns NULL if the new SimpleWorkflow object has been created without specifying the workflowId parameter; otherwise, it returns the SimpleRecord object.
Example:
copy
let copiedWorkflow = simpleWorkflow.copy();
let simpleWorkflow = new SimpleWorkflow(copiedWorkflow.sys_id);
This method deletes the workflow and all its elements.
Return:
Type
Description
Boolean
This method returns the boolean result (TRUE if the workflow was successful deleted; otherwise, returns FALSE).
Example:
delete
let copiedWorkflow = simpleWorkflow.copy();
let simpleWorkflow = new SimpleWorkflow(copiedWorkflow.sys_id);
if (simpleWorkflow.delete()) {
ss.info('Workflow deleted!');
}
This public function restarts the workflow starting with the activity specified.
Parameter(s):
Name
Type
Mandatory
Default Value
executingActivity
Simplerecord object
Y
N
current
Simplerecord object
Y
N
Return:
Type
Description
SimpleRecord object
Example:
revival
let current = new SimpleRecord('task');
current.query();
current.next();
let activity = new SimpleRecord('wf_executing_activity');
activity.query();
activity.next();
let context = (new SimpleWorkflow())->revival(activity, current);
This method returns NULL if the new SimpleWorkflow object has been created without specifying the workflowId parameter; otherwise, it returns the SimpleRecord object.
Example:
start
let context = simpleWorkflow.start(current);
if (context.state === 'finished') {
ss.info('Workflow finished!');
}