Scheduled Script Execution - Run As System User?

ehgebla
Giga Guru

Hi ServiceNow Users,

I have a general question. We have created a scheduled script execution that runs every day at 10'o'clock and checks specific incident fields. If certain values are true, the script updates the incident accordingly and also adds a work note into the record.

Everything works perfectly - however, the script somehow runs as the user who created the script so that all work notes are also being added AS the user who created the script. This leads to some notifications not running as well as we don't want the script to stop in case the user leaves the company in the future. Is there are possibility, kinda compared to Scheduled Import Jobs for example, to run the script as system user or so?

Thank you!

Regards

Elena

1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @ehgebla ,

 

You can bring the field Run as from List Layout and select the user but make sure that user is active and have the required roles,

 

To bring this field on form You can do the following,

1. Right click on Scheduled Job -> configure ->List Layout 

   

swathisarang98_0-1709896561448.png

2. from slush bucket move Run as from left to right and save it.

swathisarang98_1-1709896620254.png

 

Once you get this on form you can set the value, save it and execute it.

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang

 

 

View solution in original post

9 REPLIES 9

Harish KM
Kilo Patron
Kilo Patron

Hi @ehgebla always create a unique User and run as this user in schedule jobs so that you know how the data was updated. If you use system user or any internal user, during audit it will be difficult to figure out who actually updated the data.

Regards
Harish

Hi Harish,
we do have a user we would use for this case but that is exactly my issue: we can't change on who is running the script. Changing the run as is not possible for scheduled script executions, it seems.

How to change that without logging on as the user as create everything anew?

Hi @ehgebla you can change the user under run as field

can you share the screenshot of this job?

Regards
Harish

Raaj Kumar1
Tera Contributor

Hi, you can use the "Run As" field in the scheduled job to do this. By default it might not be displayed in the form and you need to bring it out.Schedule.PNG