Incident state updating through reply of inbound email action

Sanket Choughul
Tera Contributor

Hi Community,

I have requirement where I would like to update incidents via email by responding to email notification.
When I respond to email which has a ticket number in the subject system should take following action:

  1. Add email body to additional comments and copy all attachments from email to Incident
  2. Update status accordingly
    • If incident is on hold -> move to in progress 
    • If incident is resolved -> reopen incident (move to in progress)
1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi Sanket,

There's a base line (Out Of Box) 'Inbound Action' that does pretty much what you require called: Update Incident (BP). (You can find this by typing 'Inbound Action' in the left navigation menu)

Check this Inbound Action is present and enabled (set to true). In order to update the state as you've requested, you'll need to include the below lines above the gr.update() call.

Best practice tip: Refrain from using a variable called 'gr' as per ServiceNow baseline code in this Inbound Action. This is often seen as used when calling GlideRecord which too should ideally be  uniquely named. (rather than simply gr. Further info can be found here if you want to find out more: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713029).

For consistency, and so as to mirror ServiceNow's own coding in this Inbound Action I've used 'gr' for this example.

To help others, please mark this as correct and/or helpful.

Thanks,

Robbie.

 

Script to add: 

if (gr.state == 3) { 

gr.state = 2;

}

} else if (gr.state == 6) {
gr.state = 2;
}

 

Screen shot of existing Inbound Action:

find_real_file.png

View solution in original post

1 REPLY 1

Robbie
Kilo Patron
Kilo Patron

Hi Sanket,

There's a base line (Out Of Box) 'Inbound Action' that does pretty much what you require called: Update Incident (BP). (You can find this by typing 'Inbound Action' in the left navigation menu)

Check this Inbound Action is present and enabled (set to true). In order to update the state as you've requested, you'll need to include the below lines above the gr.update() call.

Best practice tip: Refrain from using a variable called 'gr' as per ServiceNow baseline code in this Inbound Action. This is often seen as used when calling GlideRecord which too should ideally be  uniquely named. (rather than simply gr. Further info can be found here if you want to find out more: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0713029).

For consistency, and so as to mirror ServiceNow's own coding in this Inbound Action I've used 'gr' for this example.

To help others, please mark this as correct and/or helpful.

Thanks,

Robbie.

 

Script to add: 

if (gr.state == 3) { 

gr.state = 2;

}

} else if (gr.state == 6) {
gr.state = 2;
}

 

Screen shot of existing Inbound Action:

find_real_file.png