The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DirkRedeker
Mega Sage

Hi

Have you ever wondered about the "Job IDs" of the Scheduled Job definitions, that you can find by navigating to:

> System Scheduler > Scheduled Jobs > Scheduled Jobs

Let's just pick one randomly and explore what is done here. In the screenshot below, you can find the Scheduled Job "Stock Rule Runner" (1), which utilizes the Job ID "RunScriptJob" (2).

find_real_file.png

The screenshot above shows the Scheduled Job ("Scheduled Item") called "Stock Rule Runner" (1), which uses the "Job ID" = "RunScriptJob" (2). The field "Job context" (3) holds additional information for the execution of the "RunScriptJob" - like parameters submitted to the call of the Job ID.

In this case the parameter "fcScriptName" is set to "in the schedule record" (being a "magic string" for the "RunScriptJob" Job).

For this particular case, this instructs the executing Job ("RunScriptJob"), to look into the "Script" field of the Scheduled Job/Scheduled Item and execute the Script found there.

You also could write a script directly into the "Job context" field like shown below (just prefixed by "javascript\:"):

find_real_file.png

So now you are wondering: How can I know about the possible parameters and where to find them, I can use for the different Job IDs to use, and where do I find any documentation of all of these existing Job IDs.

There is just an approach I can show you here to help yourself. Ther is no precise overview or documentation (as far as I know), but let me show, how you can investigate a bit on your own:

All existing and available "Job ID"s you can use in your Scheduled Jobs can be found in the "Sys Job" [sys_job] table of your instance.

Navigate to: "> sys_job.list" to find an overview of the registered Sys Jobs that can be referenced in Scheduled Jobs/Scheduled Items in the "Job ID" field (see screenshot below for an extract of that list).

You can find the "RunScriptJob" marked in yellow.

find_real_file.png

Opening the details of the "RunScriptJob" record, you can find (at least) some details, which may direct you any further (see screenshot below).

find_real_file.png

In the "Job details" (1) you can see a kind of description of this "Sys Job" (Note: now, we all know HOW helpful every single line of documentation may be, for other developers :-)).

Here you can see the magic string "in the schedule record", which is used in most cases.

 

Unfortunately, this is not the whole story of what this "RunScriptJob" can do for you, because reviewing the list of Scheduled Jobs under:

> System Scheduler > Scheduled Jobs > Scheduled Jobs

there are some Scheduled Jobs, which refers also to the "RunScriptJob" Sys Job "Job ID". Some of them even use different parameters than the "fcScriptName" used above.

The screenshot below shows an example of a Scheduled Jobs with different Parameters for the "RunScriptJob" Job ID:

find_real_file.png

Here, you can see, that a record with the sys_id = "e6c26ebccb133300a54f78d5634c9c7c" in the table "sysauto_script" is referenced.

Opening the table by navigating to "> sysauto_script.list", you can filter by the given sys_id and find the following record (which will be the object to be executed in this case):


find_real_file.png

 

Next steps

This was just an example of how you can drill down the details on your own, to find out more about other undiscovered Sys Jobs in ServiceNow.

As a general rule of thumb, I recommend that you search for any given Sys Job within the table "Sys Job" [sys_job] and review the "Job details" in the form view of that record.

Then, try to find any Scheduled Job, which utilizes this Sys Job and find out about HOW this was done. If possible find different Jobs using the same Sys Job to investigate even more about different options to call this JobID.

Think about it, that ServiceNow invented each Sys Job for any purpose, so it may/should be used in some script of job somewhere. That way, you can find out how this is working. It is definitively NO documentation, but it's the way you can proceed without it. >> Never give up << 🙂

 

I am afraid, that I cannot present a full list of Jobs and Parameters available.

But maybe one of you does already has one.

 

Just let me know what you think about this article.

Thanks a lot in advance for your feedback and comments on this article, you can leave here below!

 

Thanks for marking as helpful and bookmarking - that helps me determine your interest in further articles.

Enjoy ServiceNow & BR

Dirk

---------------------------------------------------------------------

If you like to also review my other articles on the ServiceNow Community, please have a look at the overview here:

Overview of my articles

NOTE: The content I provide here is based on my own experiences and does not necessarily represent my employer's views.

Comments
Naimish2
Kilo Contributor

Hi @Dirk ,

Thanks for this insightful article.

In one case, I had to override the oob BR "incident autoclose" into my customer domain. However, The Scheduled Job (Autoclose Incidents) that runs this BR always picked up the "global" domain BR, rather than the one I overrode in my customer domain.

Is there a way I can make this Scheduled Job run the overriden BR ?

Currently, the Job Context has "fcScriptName=incident autoclose". It always calls the BR "incident autoclose" from the global domain, even though I have overriden it for my child domain. Any thoughts?

 

Thanks in advance,

Naimish

DirkRedeker
Mega Sage

Hi @Naimish 

Honestly, I do not have a lot of experience with Domain Separation - sorry.

But I did a small research and where are some links, that I can suggest you to review about your issue. I hope at least one of them will help you to solve your issue.

https://hi.service-now.com/kb_view.do?sysparm_article=KB0695913

https://community.servicenow.com/community?id=community_question&sys_id=0df847a1db5cdbc01dcaf3231f96...

Let me know, if one of them did succeed.

Thanks & BR

Dirk

Laveena1
Tera Contributor

Very Helpful Article!, Thanks @DirkRedeker

Version history
Last update:
‎04-27-2020 02:41 AM
Updated by: