Calling Script Include from Scheduled Job

bradfournier
Kilo Expert

I have a script include that I am trying to call to in a scheduled job. The API Name field on the script include is 'global.CheckAssetWarranty'. However, in the script itself, the function is defined as 'function checkAssetWarranty()'. My question is, when I am trying to call the Script Include in the Scheduled Job, should I be referencing the global.CheckAssetWarranty, or the checkAssetWarranty()?

Thanks!

Brad

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi,



Below thread answers your query. Please review the same:



Call script from the Scheduled Job



You can also refer the OOB Scheduled Job "Autoclose Incidents" which calls the Business Rule "incident autoclose" in the scheduled Job. Below is the link for the OOB Scheduled Job:



https://instance.service-now.com/sys_trigger.do?sys_id=d67e98dac0a8011801393f5054790aa5&sysparm_view...



Replace "instance" with your Instance Name.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

4 REPLIES 4

shloke04
Kilo Patron

Hi,



Below thread answers your query. Please review the same:



Call script from the Scheduled Job



You can also refer the OOB Scheduled Job "Autoclose Incidents" which calls the Business Rule "incident autoclose" in the scheduled Job. Below is the link for the OOB Scheduled Job:



https://instance.service-now.com/sys_trigger.do?sys_id=d67e98dac0a8011801393f5054790aa5&sysparm_view...



Replace "instance" with your Instance Name.



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

While not exact, this article helped me figure out my problem. Thanks!


gavinparkes
Tera Contributor

Hi,



I don't think you need to call with global prefix, despite that being the API name.



Something like this in sched job.



var test = CheckAssetWarranty.myFunction(param1, param2);



Gavin


shloke04
Kilo Patron

Hi,



If your query is Resolved, Please mark the answer as correct so that the thread can be removed from the Unanswered list.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke