The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Workflow Run Script as a specific user

shembop
Tera Contributor

Presently I have a script that runs in a workflow that says after such and such happens, find the account in the sys_user table, and inactivate them. This all works perfectly, and the account is inactivated. The " problem " is that the action is done by the account "system". The ask was if it was possible to define the account that updated the record. So, I would want it to say updated by TermsServiceAccount

2 REPLIES 2

shariq3
Tera Guru

add the lines in your code just before you update the user,




gr.sys_updated_by ='sys_id of the user';



and comment the line gr.autoSysFields(false);



if you are intending to updating the name of the user who is triggering the workflow, then simply   gr.autoSysFields(true);


SanjivMeher
Kilo Patron
Kilo Patron

Hi,



If you want the Requestor name to be populated, you can use



user_record.sys_updated_by = current.request.requested_for.user_name;



Please mark this response as correct or helpful if it assisted you with your question.