Update existing incident based on email subject

snow john
Tera Contributor

Hi,

 

Can we update the incident ticket based on the email subject if the existing ticket(short description) has the same subject(short description)?

for example, I sent an email to ServiceNow with the subject "ABC (User location) anything goes here" and then if I send email to ServiceNow with the same subject line again we need to update the existing ticket subject if the ticket is ACTIVE TRUE.

 

Can someone help me on this?

 

 

Thank you in advance.

7 REPLIES 7

ersureshbe
Giga Sage
Giga Sage

Hi,

The following URL is having the OOB inbound action. If you enable it will work based on incident number.

 

YourInstanceName//sysevent_in_email_action.do?sys_id=3f789469c0a80064015ad36dc4205a9a&sysparm_record_target=sysevent_in_email_action&sysparm_record_row=2&sysparm_record_rows=5&sysparm_record_list=tableCONTAINSincident%5Etable%3Dincident%5EORDERBYorder

 

I would recommend dont go with incident short description to update the ticket.  It's not best practise. If you want to update using short description use below script.

 

var updateINC = new GlideRecord('incident');
updateINC.addQuery('short_description', email.subject);
updateINC.addQuery('active','true');
updateINC.query();
if(updateINC.next()){
current.work_notes = email.body_text;
}

Regards,
Suresh.

Hi @ersureshbe ,

 

 

I have created new inbound action and I pasted your above script in Advanced section in Inbound action but its not updating the existing ticket, its creating ticket again. Am I missing anything?

 

Below are the screenshot of inbound action

 

Inbound action: 1

snowjohn_0-1670342049231.png

 

snowjohn_1-1670342075728.png

 

Thank you.