Send a notification on Inbound email action

Jyoti36
Mega Expert

I have created an Inbound action on incident table.

Where, its matching the condition on incident, if the incident is found, then do the updates from inbound. This works fine.

Now, I just want to sent an email notification if the incident is not found. I was just wondering the following solution will work or not:

1. I am thinking of registering a new event and then using that in my else condition of the same inbound action,

2. which will then fire the notification. Is that going to work without any errors?

Please suggest if this is the best or do we have any other best option as well.

Thanks in advance!

Cheers!

23 REPLIES 23

It would be based on your requirement. What you want to do when that record is not found?


Here targetRec object is failing to fetch data so the parameter should be different. If you want to send a notification when no record is found then create a notification with the event and try this line



gs.eventQueue("task.no.snreference.found", null, gs.getUserID(), gs.getUserName());



Thanks,


Sunil Safare


Actually that didnt't worked.


My requirement is that I have to send out an email to a group(who have some email id, which I am using in my notification) based on an Inbound email action :


When incident record is not found at all in the Servicenow system, send an outbound email to that group.



For.ex: INC000XXX is the format and the Inbound email (that group) is sending it in a wrong format something like INCXXX000 or may be they have typed a wrong incident number by mistake, then I have to shoot out an email saying 'Hey this is not the correct format'.



And its not firing that email, above is the code.



Thanks!


Have you checked event logs if this event is getting fired?



Thanks,


Sunil Safare


Yes, the event is getting fired... its just not firing back an email, below is the required one...


Now its just have to do with 'null'. Instead null I have to use something where in back fires email...



gs.eventQueue("task.no.snreference.found", null, email.body.abc_reference, email.body_text);


Jyoti36
Mega Expert

Thankyou so much for your help Sunil and Pradeep!


I got it fixed using dummy object for incident.



Cheers!