The CreatorCon Call for Content is officially open! Get started here.

Workflow run script fails because of the person who closed the task before

chadlockwood
Kilo Sage

Our onboarding workflow creates an SCTASK for Service Desk to update data in AD about a rehire; someone that already has an existing user record in ServiceNow. After the SCTASK is closed, a run script queries the sys_user table and updates the record. I have found that the person from Service Desk who closed the SCTASK becomes the sys_created_by on the activity of the run script. Due to this, I have confirmed that since non-admin do not have permissions to query inactive user records, the run script fails to find the existing inactive sys_user record and therefore fails to update the record.

Is there a way to force the run script to run as system, admin, etc., instead of the user that closed the previous task?

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

HI,

If the workflow runs in system session then you should not have this issue. 

To test this theory add a 1 second timer activity in the workflow right before this run scripts, that way the next activity should run on system session and not user session.

-Anurag

View solution in original post

2 REPLIES 2

Anurag Tripathi
Mega Patron
Mega Patron

HI,

If the workflow runs in system session then you should not have this issue. 

To test this theory add a 1 second timer activity in the workflow right before this run scripts, that way the next activity should run on system session and not user session.

-Anurag

Anurag,

That appears to have resolved this issue. Thanks for the quick response.