Best Practice for Scheduled Jobs and the RunAs field

Mark Scott1
Giga Expert

Hello Community!

Today I have a question about scheduled jobs and the RunAs field.

We have a few scheduled jobs that run to send out reports or make incidents via templates. Unfortunately, those jobs are mostly running as random users (the user who created them). We've already uncovered one instance where that user had been set to inactive and the job stopped running.

My nightmare is as follows: A person in an organization is terminated and we set their account to Inactive and a bunch of scheduled jobs stop running.

Here is the question: Does ServiceNow recommend scheduled jobs run as the system user?

  1. If so, how would we make sure that the data remains domain separated (for instance, running a report that displays all active incidents at the end of the night but only for one client)?  
  2. If not, would ServiceNow suggest creating a "Service Account" in each domain for scheduled jobs to run as? Do we have to pay a license on a "Service Account" that isn't really logging in but will need all the roles?

6 REPLIES 6

sachin_namjoshi
Kilo Patron
Kilo Patron

We had faced similar issues in the past.


We created service account in sys_user table and ran scheduled jobs with service account.


If you assign role " full-filler, approver ..." to this service account, then you will have to pay license.But, you don't need to assign any role to service account just to run scheduled job.



Regards,


Sachin


Thanks Sachin,


My issue is that this is going to get expensive for every client we on-board. We're talking about a Service Account for each domain and I'm just not sure if our customers are going to like that (since its an added expense they would normally avoid if they had their own instance).


Sachin,



I tried testing this with a random user that has no roles, and the task couldn't execute anything because they did not have access to the table.


I also added the 'Run As' field to the Scheduled Reports form, and this is the field message that displayed automatically.


run as.png


I have many jobs running as service account user with no roles.


Also, you can use "System Admin" user to run scheduled jobs



Creating a Scheduled Job - ServiceNow Wiki



Regards,


Sachin