how can i trigger an event from schedule job

anoopr77
Kilo Explorer

var gr = new GlideRecord('u_email_object');

gr.addActiveQuery();

gr.addEncodedQuery('u_expiration_dateBETWEENjavascript:gs.daysAgoStart(0)@javascript:gs.endOfNextWeek()');

//query above would find records active whose expiration date field value is today

gr.query();

while (gr.next()){

gs.log(gr.u_number);

gs.eventQueue('expiration.date',current,current.u_owner,current.u_alias);

  //gs.log("testing");

}

is there any syntax wrong while calling the event expiration.date??

1 ACCEPTED SOLUTION

Subhajit1
Giga Guru

Hi Rakesh,



Current won't work in Scheduled Jobs.


That is the reason your Event is not getting triggered.


Try using this:-


gs.eventQueue('expiration.date',gr,gr.u_owner,gr.u_alias);




Thanks,


Subhajit


View solution in original post

15 REPLIES 15

what about system log -> events ?


Just want to ensure your event is processing before we look at notifications etc.



I had to investigate when a new scheduled job here was not doing what I expected


I could see there were issues with the processing in the log so it was not getting as far as running the notification


checking in demo instance? emails dont get triggered there .. check the email logs for your email copy...


checked system logs > emails ?


haven't really read the entire thread.. so i might be repeating few things ...



first, put some logs inside the script and check if it getting triggered.


second check system log -> events, if event is getting triggered (if not , see if huge number of events are already in queue that is not processed yet).


third, check system logs > emails



revert back with your updates


Hi kalai


It worked . Problem was inside ad user's with instance. Else it is working .