Cancelling an incident

John Vo1
Tera Guru

When I cancelled an incident it marks the Closed field at 11/26/2019.

find_real_file.png

 

So if I reopen that incident the Closed info is still showing 11/26/2019 and when I actually close out the incident it will still show the same 11/26/2019.  So now if managers what to run reports on that the time and dates will not be correct.  So how do I get it to where when it's cancelled the Closed field is not populated?

1 ACCEPTED SOLUTION

Try with this code:

if (current.closed_at.nil() && current.incident_state == IncidentState.CLOSED)
		current.closed_at = gs.nowDateTime();

Basically it will populated the Closed date/time field only in case of Incident closure and NOT in case of Incident cancellation.

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

View solution in original post

12 REPLIES 12

Updated the code and when I cancelled and set to closed the close field was populate with the time I cancel the incident.

Just tested it in my personal instance, in addition to the change done in the Business Rule mark_closed, you have to comment the line 3 and 4 in the Business Rule Set Closure Fields of the Task table:

find_real_file.png

In this way, it will populate the Closed date/time field ONLY for the Incidents in state Closed and NOT for the Canceled.

If I have answered your question, please mark my response as correct and/or helpful.

Thank you very much

Cheers
Alberto

Alberto, 

 

When I make this update it doesn't show closed time and date when it's set to cancelled.  The Closed field is gray out now, so when the incident does close out in 2 days will the time and date populate in the field?

 

find_real_file.png

Exactly, it will populate the time and date only when the Incident will be closed.

Glade to help you!

Cheers

Alberto

Dubz
Mega Sage

Why are you reopening a cancelled incident? Closed and cancelled incidents shouldn't be reopened, new incidents should be created and linked back to preceding one if necessary.