Notify users when their email is not related to a ticket in ServiceNow

General Add comments
by:


As my colleagues have written a couple of blogs about the email functionality in ServiceNow, I asked myself; what happens when ServiceNow does not process an incoming email notification as expected by the user. In some cases, ServiceNow will not relate incoming email notifications to any ticket, without informing the user. A simple notification in return to the user can save a lot of calls from indignant users to the Service Desk.

As this is not a difficult adjustment in ServiceNow, knowing when to send back a notification is a little bit harder.
For example; incoming email notification that are marked as ‘Junk’ by ServiceNow do not need a notification in return.
Also incoming email notifications in the ‘Inbox’ are way too early as they are not yet fully processed.
And – do you want to inform only ‘known’ users (who are registered in your ServiceNow instance) or any user that sends email to ServiceNow?
Also timing is essential; do you want to send notification back once a day or each half hour?

In this blog I created a business rule that will only pick-up email that is received within the last hour and is received from registered users and the email notification is in the ‘Received’ mailbox.
The email notification may not be in the state ‘Ready’ and most important the field ‘Table target’ is empty. I also created a scheduled job that will trigger the business rule each hour of the day. This is repeated each hour and notifications to the users will be sent at most, one hour after being received by ServiceNow.
Business Rule
What we need is a business rule that will only pick-up email notifications that are within my scope. I named the business rule to ‘Check not related email’ and let it run on the ‘sys_email’ table. I used an encoded query to determine the timespan which is required (the last hour). As this business rule will be triggered by a scheduled job, I did not use the ‘insert’, ‘update’, ‘delete’ or ‘query’ options. The following condition is applied:

[cc lang=”javascript”]
current.mailbox == ‘received’ && current.state != ‘ready’ && !current.user_id.isNil() && current.target_table.isNil()
[/cc]

Translated in regular English, the current mailbox is “received” and the current state is anything but ready.
Also the user_id is NOT empty, but the target_table is empty. The two parms are the user ID email and the initial subject. This is for reference back to the user. The gs.eventQueue will sent this information to the event that will trigger an email notification.

Scheduled job and event

For this Business Rule to run properly a scheduled job (which is needed to run each hour) and a new event is required to be registered.
As you can see in the Business Rule, the user email address and original subject is passed through to the event.
This information will be used by the email notification that will be sent back to the user.

As you can see in the scheduled job, I stated the ‘Trigger type’ is ‘Repeat’ and the repeat interval is 1 hour.
So each hour the business rule ‘check not related email’ will be executed.
As we are referring in our Business Rule to an event, we also need to define the event.

The event is on the ‘sys_email’ table, it is always handy to fill out the description and the fired by. For in the future, you know how what this event does and by what it is triggered.

The email notification

Finally, the communication back to the user will be done by an email notification. As with any notification update the message to your preferred settings. Remember to add ${event.parm2} to the message body. This will help the user identify what the initial inbound email was about. Please also ensure you select the proper event name! Else you will cause some disturbance within the organization 😉

If you have any questions you can reach me via mail at tim.willer@2e2.nl.

2 Responses to “Notify users when their email is not related to a ticket in ServiceNow”

  1. my google plus account Says:

    That is a good tip especially to those new to the
    blogosphere. Simple but very precise information… Thank you for sharing this one.
    A must read post!

  2. Morris Says:

    Everything is very open with a very clear description of the issues.
    It was really informative. Your site is very helpful. Thank you for sharing!

Leave a Reply