- 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
‎07-26-2019 08:52 AM
Hello, I am looking to define a date that is 5 business days prior to today. I tried using the solution using a 24 x 5 schedule, but cannot put a negative number in the Glide Duration. It returns the current date time. How can I subtract with this? Or do I have to go about it differently? Suggestions?
Thanks,
Trena