Script to determine age of a ticket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2015 06:10 PM
Hi everyone. I am happy you. All are here and can hopefully assist me
i tried this through inactivity monitor but it doesn't work correctly. So I would like to use another method like scripyin and have the scripting trigger an email
The parameters are. Check ll incidents if the incident is 30 days or more and still open, trigger an email to go out to the assignee of ticket. This should be done for all open, ain progress, pending or assigen. Got all tickets that are found an email is sent to the assignee and manager
i I don't want to use inactivity monitor. I would like to use a script which fire off an email
does anyone already have something like this or able ti share how this Cavan be accomplished
THANK YOU,,,
- Labels:
-
Integrations
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 03:27 PM
Thanks, did you make 2 changes to the script code? I don't see the details of the second one. Can you cut and paste what script 1 and script 2 should be and I will update them both?
THANK YOU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 03:41 PM
Sure,
Conditional script:
- var ga = new GlideAggregate('incident');
- ga.addAggregate('COUNT');
- ga.addQuery('active', 'true');
- ga.addQuery('sys_created_on', '<', gs.daysAgo(30));
- ga.query();
- ga.next();
- ga.getAggregate('COUNT') !== '0';
Script:
- var gr = new GlideRecord('incident');
- gr.addQuery('incident_state', '<', 6);
- gr.addQuery('sys_created_on', '<', gs.daysAgo(30));
- gr.query();
- gs.log('Business rule is running correctly');
- while(gr.next()){
- gs.eventQueue("incident.unresolved", gr);
- }
After you trigger the scheduled script please go to Sytem Log -> All and do a search for 'Business rule is running correctly'.
Let me know if it works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 04:08 PM
Unfortunately no its not working, There is a syntax error in script one. WHen I check syntax it returns an error, I don't know if it is critical or not. Not sure if that could be the cause.
I tried an execute now and it doesn't do anything. It executes the scheduled job but that's all. I never see incident.unreolved in the logs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 04:52 PM
Can you unchecked the conditional checkbook in the scheduled script and try again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2015 03:19 PM
Hi Edwin, I checked the system log and the search doesn't turn up anything. I checked for incident.unresolved
I also looked manually. Maybe I should delete what I have and try creating it all from scratch. I don't know what I am doing wrong that it doesn't run, so frustrating. If its not getting generated in the system log, does that mean the event isn't firing?