Running a Business Rule from an Scheduled job

jtorres
Kilo Contributor

Hello everyone.

I have a Business Rule, and I want to run it periodically, to validate an expiration date on a record, the BR works properly, but because of the nature of BRs I have to either update or insert the form, for it to trigger, I read that we could run it from an scheduled job, but I haven't found the way to set the relation between them.

var now = gs.endOfYesterday();

var vigencia = current.u_fecha_fin; //expiration dateif(vigencia < now){

current.u_hrs_vencidas = current.u_hrs_restantes;

current.u_hrs_restantes = 0;

current.u_activo = 'true';

gs.addInfoMessage("TEST");

}

Could anyone please help me find the best way to do this?

Thanks in advance and regards!.

1 ACCEPTED SOLUTION

crhistopherjuar
Kilo Expert

Hi Irving,


I recommend to you, this app developed by Chui Tomasi.



ServiceNow Share


Scriptless Scheduled Jobs - YouTube



P.S. Please hit like, helpful or correct for my responses as they apply to you


View solution in original post

15 REPLIES 15

what release you are running? I don't see the Autoclose Incidents scheduled job, and below is my screenshot for a new scheduled job form


find_real_file.png





Did I miss something?



Thanks!



Jerry


Hi Jerry, You'll see, there are two different "scheduled jobs" modules, one of them belongs to the System scheduler application, and the other one to the system definition Application. You will find the Autoclose Incidents scheduled job in the Module found in System scheduler application (modify the next URL to access to the list on your instance: https://YOURINSTANCENAME.service-now.com/sys_trigger_list.do)



Also, the form from your screenshot, belongs to the scheduled jobs module found in the System Definition application



find_real_file.png



By the way we're running



"Build name: Helsinki


Build date: 11-08-2016_1607


Build tag: glide-helsinki-03-16-2016__patch7-11-02-2016"



Regards!


Got it and thanks lot!



Jerry


How to execute this job like we have execute now for the other script?

crhistopherjuar
Kilo Expert

Hi Irving,


I recommend to you, this app developed by Chui Tomasi.



ServiceNow Share


Scriptless Scheduled Jobs - YouTube



P.S. Please hit like, helpful or correct for my responses as they apply to you