Send Notification on Following Condition

Suyash Joshi
Tera Contributor

Hello Everyone, 
While working on Email Notification I was stuck at following requirement i.e:-
1. When the RTIM Submitted
2. If the RITM is not approved after Five days.
3. If the RITM is not approved after Ten days.
4. The RTIM Cancelled if it is not approved, after 14 days.

Anyone who could complete my requirement it will be very helpful to me 
Kind Regards,

Suyash Joshi

2 REPLIES 2

gajananvwit
Tera Contributor

Hi Suyash,

1. When the RTIM Submitted - Create normal Notification on sc_req_item table and add condition item is your catalog item name and send notification to your requested person.

2. If the RITM is not approved after Five days. - use scheduled job for below requirement 

Glide to RITM table and take correct RITM sys ID and your item

var gr = new GlideRecord('sc_req_item');

gr.addQuery('item','your item sysID');

gr.query();

if(gr.next()){

// user below Approval script 

}

use below script to validate if approval is created and not updated to approved for 5 days.

use script in workflow and check if Approval is approved or not.

var gr = new GlideRecord('sysapproval_approver');

gr.addEncodedQuery('sysapproval='+current.sys_id);

gr.addEncodedQuery('state!=approved^sys_created_onRELATIVEGT@dayofweek@ahead@5');

gr.query();

if(gr.next())

{

// send notification using eventQueue;

}

4. The RTIM Cancelled if it is not approved, after 14 days. And use Wait for condition in workflow.

if(current.state==''cancelled') // add your cancelled state value;

{

var gr = new GlideRecord('sysapproval_approver');

gr.addEncodedQuery('sysapproval='+current.sys_id);

gr.addEncodedQuery('state!=approved^sys_created_onRELATIVEGT@dayofweek@ahead@5');

gr.query();

if(gr.next())

{

// send notification using eventQueue;

}

}

 

Can you give me a EXAMPLE of eventQueue I have no knowledge about notification.