Need help - Sent notifications every 5 days until the approver responds to the request or the ticket is closed.

Tina24
Giga Guru

I am really need of some expert suggestions.

User want to have notifications for the current assigned approver(s) of requests sent every 5 days until the approver responds to the request or the ticket is closed.

Workflow:

find_real_file.png

1 ACCEPTED SOLUTION

shloke04
Kilo Patron

Hi,

Please find the steps below to achieve your requirement:

1) Navigate to "Registry" module and create a event as below:

2) Select table as sysapproval_approver as shown below:

find_real_file.png

3) Navigate to the module "Scheduled Job" under System Definition and select Automatically run a script and use the script below:

Script for reference:

sendNotif();

function sendNotif(){
	var gr = new GlideRecord('sysapproval_approver');
	gr.addEncodedQuery('state=requested^sys_created_onRELATIVELT@dayofweek@ahead@5^source_table=sc_req_item'); // Replace "sc_req_item" with the Table for which you want to trigger notification
	gr.query();
	while(gr.next()){
		gs.eventQueue('send.notif',gr,gr.approver); // "send.notif is the Event name configured in step 1. Also, "gr.approver" replace it with the recipient to whom you want to trigger.
	}
}

 

Scheduled Job Frequency:

find_real_file.png

Now finally configure your notification and make sure to make it event based and check the parameter "parm1 and send to event creator as tru as shown below:

Notification will be on Approval table:

find_real_file.png

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

7 REPLIES 7

shloke04
Kilo Patron

Hi,

Please find the steps below to achieve your requirement:

1) Navigate to "Registry" module and create a event as below:

2) Select table as sysapproval_approver as shown below:

find_real_file.png

3) Navigate to the module "Scheduled Job" under System Definition and select Automatically run a script and use the script below:

Script for reference:

sendNotif();

function sendNotif(){
	var gr = new GlideRecord('sysapproval_approver');
	gr.addEncodedQuery('state=requested^sys_created_onRELATIVELT@dayofweek@ahead@5^source_table=sc_req_item'); // Replace "sc_req_item" with the Table for which you want to trigger notification
	gr.query();
	while(gr.next()){
		gs.eventQueue('send.notif',gr,gr.approver); // "send.notif is the Event name configured in step 1. Also, "gr.approver" replace it with the recipient to whom you want to trigger.
	}
}

 

Scheduled Job Frequency:

find_real_file.png

Now finally configure your notification and make sure to make it event based and check the parameter "parm1 and send to event creator as tru as shown below:

Notification will be on Approval table:

find_real_file.png

find_real_file.png

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hi @shloke04

 

Can you please make me understand your condition that you have written in scheduled job. 

gr.addEncodedQuery('state=requested^sys_created_onRELATIVELT@dayofweek@ahead@5^source_table=sc_req_item');

 

Regards, 

Nivedita 

 

 

Hi @shloke04 ,

 

Can you please guide me, I have a same kind of requirement, where i need to trigger notification in regular interval of time for every 5 years until the ticket is closed based on the Date present in the Custom field Test Date. I have followed every step, but in scheduled job i'm not able to set 1826 days periodically can you please help how can i solve this.

 

Field type - Date

Field Name - TEST DATE (u_test_date)

Event name- Test Date

 

For Example: If the date present on TEST DATE field is 9-Jan-2025, i want notification to be triggered for respective few people every 5 years for 2030, 2035, 2040 ... until its moved to Closed state. The date on TEST DATE will remain same i.e. 9-Jan-2025. The Test date will vary for every ticket.

 

Thanks in advance.