How do I create a new incident from an email response to a closed incident?

ewanh
Kilo Expert

Current State:

When someone replies to a Closed (Not Active) incident it updates that incident and does not change the state.

Desired State:

When someone replies to a Closed (Not Active) Incident it creates a new incident

Is there a standard or recommended solution for this?

1 ACCEPTED SOLUTION

Brian Dailey1
Kilo Sage

Hi Ewan,



Here is one way you can open a new Incident in response instead of updating a closed INC...



Look in your Inbound Email Actions and find the one(s) used to Update Incidents, it should have the email Type set to 'Reply' (or possibly 'Forward') instead of 'New'.  



  1. At the beginning of your IEA script, perform a check to see if the ticket has been closed (check whether it's active, or look for specific states):

    if(current.active == false){
        ...
    }
  2. If the condition matches, just create a new Incident using a GlideRecord and fill in the blanks with info from your email and the existing closed Incident, I'd set the existing INC as the parent.

    if(current.active == false){
        var gr = new GlideRecord('incident');
        gr.initialize();
        gr.opened_by = email.from_sys_id;
        gr.caller_id = email.from_sys_id;
        gr.description = email.body;
        gr.short_description = email.subject;
        gr.parent = current.sys_id;
        ... (grab some other relevant info from your existing INC using 'current')
        gr.insert();
        (avoid the 'current.update()' statement somehow using a break, return, etc.)
    }
    else{
        (perform your normal IEA update code)
        ...
    }



See how that works out for you.




Thanks,


-Brian


View solution in original post

6 REPLIES 6

Rahul Jain11
Kilo Guru

It depend on the process what you are following. If you are allowing to users to reply the incident so that they inform about the issue is solved or not, then it should either update or reopened the same incident.



If closed incident means no further work can be done on this and can't be reopen then it should create new incident.


Brian Dailey1
Kilo Sage

Hi Ewan,



Here is one way you can open a new Incident in response instead of updating a closed INC...



Look in your Inbound Email Actions and find the one(s) used to Update Incidents, it should have the email Type set to 'Reply' (or possibly 'Forward') instead of 'New'.  



  1. At the beginning of your IEA script, perform a check to see if the ticket has been closed (check whether it's active, or look for specific states):

    if(current.active == false){
        ...
    }
  2. If the condition matches, just create a new Incident using a GlideRecord and fill in the blanks with info from your email and the existing closed Incident, I'd set the existing INC as the parent.

    if(current.active == false){
        var gr = new GlideRecord('incident');
        gr.initialize();
        gr.opened_by = email.from_sys_id;
        gr.caller_id = email.from_sys_id;
        gr.description = email.body;
        gr.short_description = email.subject;
        gr.parent = current.sys_id;
        ... (grab some other relevant info from your existing INC using 'current')
        gr.insert();
        (avoid the 'current.update()' statement somehow using a break, return, etc.)
    }
    else{
        (perform your normal IEA update code)
        ...
    }



See how that works out for you.




Thanks,


-Brian


Works!   Thank you Brian.  


Welcome.