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

Thank you so much for your recommendation about this app I gave it a try and it's great actually, makes it look like a business rule which is awesome, huge shout out to Chui Tomasi ctomasi for developing this great app!



Regards!.


You are very welcome. I'm glad you find it helpful.


which release does your app apply?




Thanks!



Jerry


I built the app on Helsinki and tested it on Istanbul. It also runs on Geneva, but you have ignore about 6 errors on the update set preview. It's trying to put records in a system table that didn't come out until Helsinki. That does not impact the functionality of the app.


Got it and thanks lot!



Jerry