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

HI anurag


in eventlogs i am able to see parm1 i.e U-owner . but not able to send an email   that person using notification .


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


Hi subhajit



What youn told was right , after i used gr now event is triggered abd also in the logs i am able to see correct sys_ids in parm1 and parm2. But problem is notification mail is not been sent . any inputs as to why notification is not sent .


pic.PNG


anything in the ecc queue to indicate if it was processes successfully or errored ?


and who is / are the receipients ?


HI Julian


I am not able to see any entries in ECC queue related to this job. recipients are users in the instance(randomnly selected to chk ).in real it should be sent to service desk suport group.