To lock a record based on the return value of a workflowaction script:
Specify the type of the return value as the script parameter. For example, if the return value is 0 or 1:
Eg:
if(statusInfo === ‘Approved’){
return 1;
}else{
return 0;
}
Here, the return type is an integer number, so you can specify it as a script parameter.

For locking the record, we can use the “Lock Record” state in the workflow.
In the workflow add a field to store the script parameter :


Add a state and select the WorkFlowAction script as the new action.

In the ‘Parameters- store result in field’ specify the workflow field created.

Select “Lock Record” as another state action and add the required condition to lock the record.
