- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 08:59 AM
Hi All,
Good evening to all.
I had a requirement to notify the problem manager prior to 2 days based on the due date. The below script of mine is working as expected.
My schedule job script below:
Script name : Problem Task Due date Reminder two days
queryPlannedDate();
function queryPlannedDate(){
var qrystr = "active=true^due_date>javascript:gs.daysAgoEnd(-1)^due_date<javascript:gs.daysAgoEnd(-2)";
var expdt = new GlideRecord('problem_task');
expdt.addEncodedQuery(qrystr);
expdt.query();
while(expdt.next()){
gs.eventQueue('problem_task.duedate1', expdt, expdt.assigned_to);
}
}
This script will execute on daily basis. It is working fine. Now the user tweaked the request and he wants exclude the week end(saturday and sunday). If the Problem task due is on Monday, The script should skip the saturday and sunday and fire on thursday( 2 days prior excluding weekends ). If the problem task due date is on Tuesday, This script will trigger on Friday.
Is there a way I can modify my script or any suggestions would be of great help because I have no clue on how to exclude weekends from the script.
Note : the above script is running based on al calendar days.
Thanks
Kamal
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 04:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 09:11 AM
Hi Kamal,
You need to use schedule in this calculation and determine when it should trigger.
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎08-20-2018 10:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 10:25 AM
Hi Kamal,
Iterate over every record and use Duration calculator. take due date from record and using duration calculator add 2 days. if it is today then trigger email
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
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
‎08-20-2018 11:09 AM
Still I am not getting ankur. Please explain me and help me what should I right in my script?
to call the schedules?
Thanks,
Kamal