When a record is locked by Workflow, it cannot be edited and submitted regardless of the role used. In SuiteScript, the equivalent APIs of these two actions (edit and submit) are record.load() and record.submitFields(). If these APIs are executed against a locked record, the following error is thrown:
RCRD_LOCKED_BY_WF: This record has been locked by a user defined workflow.
To get around the error, control Lock Record actions by providing more flexible conditions. One solution is to create a custom transaction body field, which will store the User’s ID who needs to update the record.
Custom Field then should be added on the Workflow Condition so it may know if record should be locked or not.

On the script, update the custom transaction body field value with the User’s ID before editing the record so that the record will not be locked for this particular user and the error will not be thrown any more.