Workflow switching to run as 'System' user if adding a Timer

klautrup
Kilo Expert

Hi,
I initiate a workflow by having a scheduled job running as a user named 'uCMDB_Integration'.

In the workflow I have 2 scripts where I split the transformation of 10 import sets (5 transformations started in each script):

find_real_file.png

Both are run as the user 'uCMDB_Integration as seen here in the system log:
 find_real_file.png

 

However, if I add a Timer between the 2 scripts in the workflow:
find_real_file.png

The 2nd script switches to run as the 'System' user:

How do I avoid this?

Regards,
Kristian

9 REPLIES 9

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Klautrup,

You need to debug this by adding some log statements

How are you triggering the data transformation.
Is it through Scheduled Data Import? If yes then what is the Run as User field value.

Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi,

It is a scheduled job with 'Run as User' set to my "uCMDB_Integration" user and the workflow as you see fine starts out running under this user. But as soon as I add a timer to the workflow that seems to cause a switch to the "System" user.

klautrup
Kilo Expert

Anybody having a solution to this?

Can't I expect a workflow to keep running as the user starting the workflow if a timer is added in the workflow?

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

That is an expected behavior and everything running after the Timer would be under system user. I would suggest you try "Wait for condition" if possible as far as I remember it runs on user context:

 

https://docs.servicenow.com/bundle/kingston-servicenow-platform/page/administer/workflow-activities/reference/r_WaitForCondition.html

 

Regards,

Sergiu