- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2022 11:27 PM
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 |
Solved! Go to Solution.
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 12:13 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2022 11:43 PM
Hello,
You can use something of the below code to implement this:-
var result = true;
var gdt = new GlideDateTime();
var day = gdt.getDayOfWeekLocalTime(); //The day of week value from 1 to 7. Monday equals 1, Sunday equals 7.
if (day == 6 || day == 7)
result = false;
result;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2022 12:13 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2022 07:56 AM
Did you get a chance to check on my above response?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader