Automatic Notification per 2 business days

dianemiro
Kilo Sage

Hi Guys,

Can anyone help me on how to create an automatic notification to requested for of a Request Item if the tickets are still Waiting for Approval and Created more than 2 days. Many thanks for your help.

1 ACCEPTED SOLUTION

dianemiro
Kilo Sage

Hi All,



Thank you ALL so much for your help. All replies are helpful. For record purposes, I will summarize and combine all suggested solution:



Step 1. I created a Template for the Notification.


Step 2. I created an Event.


find_real_file.png


Step 3. From this Template I created a Notification thanks to Kuruva Venkateswarlu and Amlan Pal.


find_real_file.png


find_real_file.png


find_real_file.png


Step 4. I created a Scheduled job (script from @Sneha Binani)


var gr = new GlideRecord("sc_req_item");


gr.addEncodedQuery("stage=waiting_for_approval^sys_created_onRELATIVELT@dayofweek@ahead@2^cat_item=da4e262f3784620065f498a543990ed4");


gr.query();


while(gr.next()){


gs.eventQueue("sap_user.requesters.reminders",gr,"","");


}


For Wednesday:


find_real_file.png


For Friday:find_real_file.png



I was able to complete what I want. Again thank you all!!!


View solution in original post

13 REPLIES 13

Hi Amlan,



Thanks. I have followed your instructions and we have 39 tickets that are created more than 2 days but the notification won't work. Here's what I've done so far:



find_real_file.png


find_real_file.png



I created a Template which contains the email body and created the notification you said. Thanks.


Hi Diane


For Every two days we need to create a Schedule job for this place this script in the Schedule job script



var tsk = new GlideRecord('sc_req_item');


tsk.addQuery('request_item',current.sys_id);


tsk.addQuery('active','true');


tsk.addQuery('stage','');//place ur stage   value here


tsk.query();


while (tsk.next()){


  gs.eventQueue("sc_req_item.state",current,gs.getUserName());


}


You need to configure the Email Notification on Requested Item (sc_req_item) table with the conditions and other configurations as of below screen shot



find_real_file.png


find_real_file.png



i hope this will helpful to u


Hi Diane,



You need to create a schedule job with the same condition as mentioned in when to send field here in Notification and then trigger the event from there.



Here are the steps.



1. Go to System Policy -- registry.


Create a registry by giving the name as trigger.notification.ritm and table as sc_req_item.



2. Create a Schedule Script exceution



Place the below code.



var gr = new GlideRecord("sc_req_item");


gr.addEncodedQuery("stage=waiting_for_approval^sys_created_onRELATIVELT@dayofweek@ahead@2");


gr.query();


while(gr.next()){


gs.eventQueue("trigger.notification.ritm",gr,"","");


}



3. Now in Notification select when to run as Event is triggered and select the same event that is created.


Place in your template and ither details.



Hope this helps you


Hello Sneha,



Thank you for your response. How can I set the Scheduled Jobs to only execute every Wednesdays and Fridays? Many thanks.


Hi Diane,



You can create two schedule job which once on weekly basis one on Wednesday and the other on Friday.



find_real_file.png



Hope this helps you