How to call scheduled job from business rule

sanket mohite
Tera Expert
 
2 REPLIES 2

Astik Thombare
Tera Sage

Hi @sanket mohite ,

 

Below is the code snippet which we can write in business rule, script include on any server side script to execute the scheduled job when we need it means OnDemand

 

var objSchedule = new GlideRecord('sysauto_script');   //sysauto_script is a schedule job table name.
objSchedule .addQuery('name','--ScheduleJobName---');
objSchedule .query();
if(newGR.next()){
SncTriggerSynchronizer.executeNow(objSchedule );  //This will execute the schedule job mentioned above in addQuery.
}

For more information follow below link -

 

https://www.basicoservicenowlearning.in/2020/04/scheduled-jobs-servicenow.html

 

if my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful." This action benefits both the community and me.

 

Thanks,

Astik

 

 

Service_RNow
Mega Sage

Hi @sanket mohite 

 

please follow this thread

 

How to Call Script Include in ServiceNow l Script Include Examples 

 

Please mark reply as Helpful/Correct, if applicable. Thanks!