Workflow Run Script as a specific user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2017 09:03 AM
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
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2017 09:15 AM
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);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2017 09:55 AM
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.