Automatic Reply when Incident does not log via inbound action

sruthy
Tera Contributor

When the incident does not log to the system via email (Inbound action), Can we create a automatic reply to the user that the incident does not created in the system?

3 REPLIES 3

Runjay Patel
Giga Sage

Hi @sruthy ,

 

Yes, you can do that.

 

1. Create even based notification 

if (current.canCreate())
    current.insert();
 
2. if current.insert(); fail then trigger  

 

gs.eventQueue('your event name,current,current.number,gs.getUserName());

 

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
LinkedIn: https://www.linkedin.com/in/runjay
YouTube: https://www.youtube.com/@RunjayP

-------------------------------------------------------------------------

 

JenniferRah
Mega Sage

If I understand your question correctly, you have an inbound action that sometimes has an error and does not create the incident. When that happens, you want to send an email. Is that correct? If so, here's a solution I have implemented in one of our inbound actions. 

 

1. Create an event called inbound.sys_email.error_message.

 

2. Create a Notification to send an email when the above event is triggered.

 

3. In your Inbound action, check for the condition(s) that make it fail and add the following code:

logger.logError("ERROR - Required information missing. No incident submitted.");
sys_email.setValue('error_string', "ERROR - Required information missing. No incident submitted.");
sys_email.update();
gs.eventQueue('inbound.sys_email.error_message', sys_email, sys_email.error_string, email.body_text);

 This will set the error string value in the sys_email record and trigger the notification.

Sumanth16
Kilo Patron

Hi @sruthy ,

 

Please refer below thread:

https://www.servicenow.com/community/developer-forum/how-to-setup-auto-replies-for-incoming-emails-t...

 

Hope the answer has helped you, please mark the answer correct/helpful. 

 

Thanks & Regards,

Sumanth meda