Need to trigger notification like a reminder to catalog variable users .

Shweta Gupta
Tera Contributor

Hi Experts,

 

We have to trigger Notification like a reminder to catalog variable users just a day before the variable To Date .

 

I tried using event registry but it is not working. Can I ask for any other or simple approach to achieve it . 

 

Thanks in Advance .

Shweta 

13 REPLIES 13

Yes it will always run and send notification at the time you have set.

Please mark my answer as "Helpful" if its helpful to you.

Thank you
Rishabh

Hi @rishabh katari1 

 

Yes it worked but its triggering notification for only one record which we created first time using the catalog item irrespective of the condition mentioned in schedule job like trigger date should be a day before the variables date . Any idea why its happening . I am using the below code .

 

var todayDT = new GlideDate();
var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item""c737510e87435510962ceca83cab356a");
gr.query();
if (gr.next()){
    var captureDate = new GlideDateTime(gr.variables.name);
    captureDate.addDays(-1);
    var newDT = captureDate.getDate();
    var requestor = gr.variables.varName;
    var requestorM = gr.variables.varName1;
    if (newDT == todayDT)
    //gs.log("Its now working");
{
gs.eventQueue('RAF.expiry',gr,requestorM,requestor);

}
}
 
Thanks in Advance
Shweta

Hi @Shweta Gupta,

You can use while if you want to do this for multiple order for the same catalog item:

You need to modify the code:

var todayDT = new GlideDate();
var gr = new GlideRecord("sc_req_item");
gr.addQuery("cat_item", "c737510e87435510962ceca83cab356a");
gr.query();
while (gr.next()){
    var captureDate = new GlideDateTime(gr.variables.name);
    captureDate.addDays(-1);
    var newDT = captureDate.getDate();
    var requestor = gr.variables.varName;
    var requestorM = gr.variables.varName1;
    if (newDT == todayDT)
    //gs.log("Its now working");
{
gs.eventQueue('RAF.expiry',gr,requestorM,requestor);

}
}

 

Please mark my answer as "helpful" if its working good enough.

 

Thanks,

Rishabh

Hi @rishabh katari1 

 

Can you please suggest its not even triggering any notifications . 

 

Thanks

Shweta