Custom Script - needs to update a field upon a workflow action that submits the document

I have a workflow on the Puchase Order document. One of the Workflow actions submits the PO. Through a custom script I want to capture the full name of the person submitting the document and store it in a custom field of the document. isn’t working as the document is sumitted and submitted documents cannot be saved. I tried changing the custom field to Allow on Submit but that’s not working either. Is there a function that can update a submitted document that can be called in a custom script (called client script in ver 13). Or is there any way I can get the custom script to run after the workflow action is initiated but before the document is submitted? Then I can use