The CreatorCon Call for Content is officially open! Get started here.

Script to determine age of a ticket

reeset
Kilo Contributor

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,,,

24 REPLIES 24

Yes Terry,



The event is not getting fired in the business rule, I just made another change to my original post. I'm almost positive that it is going to work this time. Could you please try again with this code in the business rule?


Terry,



Email notification is looking good.



I just realized the Event screenshot that you shared was from System Policy -> Events -> Registry. Can you please do a search for "incident.unresolved" on System Logs -> Events?


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


reeset
Kilo Contributor

Hi, I tried checking and unchecking conditional and nothing happens.   No updates in the log.


edwin_munoz
Mega Guru

Terry,



I just tested this, it is working in my instance with and without conditional.



Could you please share you scheduled job? After you run the job you should see the events created in System logs -> events.



EDIT: Could you run this script as a Background script? (Scripts - Background in navigation bar)



  1. var i = 0;
  2. var gr = new GlideRecord('incident');  
  3. gr.addQuery('incident_state', '<', 6);  
  4. gr.addQuery('sys_created_on', '<', gs.daysAgo(30));  
  5. gr.query();  
  6.  
  7.  
  8. while(gr.next()){  
  9.   i++;r);  
  10. }

  11. gs.print(i);