Exclude week ends for sending remainder notification for approver of request .

Bhanupriya
Giga Contributor

Hi All,

    I have following requirement to send  the remainder notification.

Scenario: Service Requests which have Approval workflow defined needs to be approved within 2 weeks (14 Calendar days) of creation. If the request is not approved within 2 Weeks the request will get auto rejected and the requested for has to be notified accordingly. The  week ends should be excluded when we send the Remainder notification on 0th day ,5th Day.10th Day and 14th Day .Please do let me know how to achieve  this in workflow as soon as possible.               

Notifications needs to be triggered as mentioned in the table below.

 

Day

Trigger

Users to be notified

Request Stage

Task State

Day 0

Notification 1

Approver

Waiting for approval

Requested

Day 5

Notification 2

Approver

Waiting for approval

Requested

Day 10

Notification 3

Approver

Waiting for approval

Requested

Day14

Notification 4

Approver & Requested for

Closed Incomplete

Cancelled

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Bhanupriya 

you can run daily scheduled job and check the difference between created and now time and based on that send email

I have shared solution something similar earlier; enhance as per your requirement

sendEmail();

function sendEmail(){
	try{
		var gr = new GlideRecord('sysapproval_approver');
		// add extra query if required
		gr.addQuery('state=requested');
		gr.query();
		while(gr.next()){
			var gdt = new GlideDateTime(gr.sys_created_on);
			var nowTime = new GlideDateTime();

			var duration = GlideDateTime.subtract(gdt, nowTime);
			var days = duration.getDayPart();
			if(days == 0 || days == 5 || days == 10 || days == 14){
				gs.eventQueue("event_name", gr, 'your recipients');
			}
		}
	}
	catch(ex){
		gs.info('Exception'+ex);
	}
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Maik Skoddow
Tera Patron
Tera Patron

Hi @Bhanupriya 

regardless of the implementation approach (Scheduled Job, Flow, Workflow) you always can configure a business calendar (see https://docs.servicenow.com/bundle/rome-platform-administration/page/administer/time/concept/busines...

OOTB there is already a Business Calendar for working days and excluding the weekends available you can choose. 

An example for Scheduled Jobs:

find_real_file.png

Kind regards
Maik

Hi Maik,

 

           Thanks for your reply.I want to know how can i send remainder notification for 5th day and 10th day and 14th day specifically?

Hi @Bhanupriya 

okay, I suppose you are more a beginner and therefore I recommend using the Flow Designer which allows to implement your requirement with a no-code approach. Please have a look at the following resources for the Flow Designer approach: 

But in case you prefer the pro-code approach you will find the instructions at https://davidmac.pro/posts/2021-02-10-approval-reminder/

Let me know if you have any further questions.

Kind regards
Maik

Hi @Bhanupriya 

In case you think I was able to answer your question, I would be happy if you mark the appropriate response as "correct" so that the question will appear as resolved for other users who may have a similar question in the future.

If not, please tell me what you are still missing!

Many thanks & kind regards
Maik