- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 06:21 AM
I need to be able to send out emails to the assigned user from the incident table. The assignment group is anything BUT Service Desk and there has been no updated activity to the ticket in 3 days. This will serve as a reminder for them but I am unsure on the script and I have been hearing different ways to accomplish this. Some say a work flow, some says a BR or scheduled job. Any suggestion will do. Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2024 05:56 AM
So you'll need to do two things before the flow if you don't already have these. You'll need to register an Event, then create/set your notification to trigger from your Event. Your overall flow would look like this
Your trigger you set to daily and set to whatever time you want it to run
You would look up all records with these conditions
If you find records
Then for each record found
Fire your event which will trigger your notification for each record
Keep in mind, if you are using Washington or Xanadu, the Fire Event action is out of the box. If you are on anything before Washington, you'll need to create a custom action to fire the event. Please let me know if you have any more questions. This solution requires no coding (unless you have to build the custom action, in which case it takes 1-2 lines of code)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 12:26 PM - edited ‎08-07-2024 12:29 PM
Hi @MoeG82 ,
Create scheduled job which runs daily.
try this script below; you will have to iterate over all problem records
that could be a limitation
var problem= new GlideRecord('problem');
problem.addActiveQuery();//update your query
problem.query();
while(problem.next()){
var updatedTime = problem.sys_updated_on;
var days = 3;
var dur = new GlideDuration(60*60*24*days*1000);
// paste the sys_id of the 8*5 weekday schedule excluding holidays and weekends
var schedule = new GlideSchedule('090eecae0a0a0b260077e1dfa71da828');
var finalTime = schedule.add(updatedTime, dur,'');
var updatedGdt = new GlideDateTime(updatedTime);
var finalTimeGdt = new GlideDateTime(finalTime);
// if the date/time after adding 5 business days is greater than updated time
if(finalTimeGdt > updatedGdt){
gs.eventQueue('my.event', current, gr.assigned_to);
}
}
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2024 12:44 PM - edited ‎08-07-2024 12:48 PM
Hello @MoeG82 ,
Try with this Scheduled Job --
(function executeRule() {
var gr = new GlideRecord('incident');
gr.addEncodedQuery('assignment_group!=YOUR_SERVICE_DESK_GROUP_SYS_ID^sys_updated_on<javascript:
gs.daysAgo(3)^active=true');
gr.query();
while (gr.next()) {
// Prepare and send email
var mail = new GlideEmailOutbound();
mail.setSubject("Reminder: Your Incident Requires Attention");
mail.setBody("Dear " + gr.assigned_to.name + ",<br><br>Your incident with number " + gr.number + " has not been updated for 3 days. Please review and take necessary actions.<br><br>Thank you.");
mail.setTo(gr.assigned_to.email);
mail.send();
}
});
/* Note: Assignment Group Filter: Replace YOUR_SERVICE_DESK_GROUP_SYS_ID with the actual sys_id of the
"Service Desk" assignment group. */
If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2024 09:23 AM
Thank you. Which sys ID am I getting? Is it the sys ID from the incident table as a whole? The parameters are any group other than the Service Desk and we have a few of them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2024 10:18 PM - edited ‎08-08-2024 10:19 PM
@MoeG82 ,
In the GlideRecord query you're using, YOUR_SERVICE_DESK_GROUP_SYS_ID should be replaced with the Sys ID of the Service Desk group you want to exclude from the results. This is the Sys ID of the group from the sys_user_group table, not from the incident table.
Query Explanation ---
assignment_group!=YOUR_SERVICE_DESK_GROUP_SYS_ID: This part of the query selects incidents where the assignment_group is not equal to the specified Service Desk group’s Sys ID.
sys_updated_on<javascript:gs.daysAgo(3): This part selects incidents that were last updated more than 3 days ago.
active=true: This ensures that only active incidents are considered.
If you found my response helpful, please consider marking it as "Helpful" or "Accept Solution." Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2024 07:28 AM
line 4 keeps getting an error: