Updated: Jul 13, 2022
With Omari Warren
In this article, we're going to go over inbound email actions and why one would want to use them. Inbound email actions are similar to business rules: both use conditions and scripts that take action on a target table. An inbound email action checks the email for a watermark that associates it with a task and checks for other conditions.
Understanding Inbound Email Actions
Inbound email actions might be used to do something simple like create a record, update a record, or another email or notification to approve an approval request or maybe reject it. One thing to emphasize is that you want to keep your inbound actions for simple tasks and things within the system. If someone is trying to do something complicated, it is strongly advised for you to guide them to use the system and the tool for what it is. One of the reasons you don’t want to do anything too complex is because you don't want to get stuck in a position where you're giving complicated instructions to users that are hard to remember and difficult to follow. You also don't want to risk bogging down the system with complicated scripts hitting the database so, as mentioned previously, you want to keep things simple.
That being said, inbound actions are a great tool for doing simple things that you may want to do when you don't have access to the tool; maybe you're on your phone or maybe you're away from the office. Some of the things that you can do with an email inbound action include recording certain things to the record, and triggering replies to users.
One of the conditions is based on type — is it a new email, a reply, or a forward to the system? Note that when you're developing these and want to test them, make sure you have the outbound email configuration set and the inbound email configuration set with an email address that you can use to actually test your work. Be sure that when you change the email, you change it back once you're done working with inbound actions.
How The System Recognizes the Email
How does the system recognize an email that's meant for a certain record? Let's use this incident as an example (reference 2:57 in the video). When the system sends out an email to a user, there's something called a watermark. When a user is replying with that watermark, the system recognizes that and knows that they're replying to that, and it also recognizes the user by their email address in the system.
One option you have with inbound actions is to stop processing other inbound actions. Sometimes you don't want to trigger a cascade of other inbound actions or emails going out to the user. Let’s say a user sends an email to the system to cancel requests. You might not want to process other emails after that, so you would check the Stop Processing option to keep that from happening.
Let’s say you do want certain inbound access to the process, but when it gets to this one you want it to stop. You can define that with the Execution Order. If you have emails with a higher order than the set Execution Order number, they'll actually process, and once it gets down here and you have this checkbox chat (reference 4:06 in the video), the system will stop processing that.
You can also set certain conditions you see (shown above), so that way you can control the traffic within the system and filter out certain emails that you don't want to process. You can also set it by certain roles; maybe you only want managers to have this ability. You can assign that row to managers, and this inbound action will only trigger if that user has the manager role.
Developing an Inbound Email Action
Now let's go over to the Actions tab. When you're developing an inbound email action, you can set certain fields when you're creating a record. This example is creating an incident, so you can set the caller ID to the user that's in an email, add comments to it, set the short description, etc.
You can also set field values here. Shown here is a description of what the inbound action does (reference 6:14 in the video). The developer can put a description here, or if you're using one of the out-of-the-box inbound actions, use a description over as shown for the user. This has already been tested for this demo, so you can see here I sent an email to the system.
Let's say you are trying to create an inbound action — you want to access something but you don't know how to get to it. You may want to search the header or code for the header. If you're looking for something that you know is in there like say the email went out to multiple users and you're trying to code based on that, that information is usually in the header, if it's not in the subject or body, so just keep that in mind when you're developing that.
Creating an Incident
Going back to the email we sent to the system, we wanted to create an incident. To create an incident, we sent in an email to this developer instance with a subject and body information (reference video at 7:30). This created a new instance; it set the short description and shows that we sent an email and the context. As you can see it matched up to our email address and once it recognized us, it created this incident.
If we go back to the original email, you can see all the inbound actions and scripts that it skipped. You can also attach email attachments to the record. You can see the system replied with a notification, which isn't related to this, but triggered one out because of the email that we sent out. We will go ahead and remove that email address once we're done and save it. You can get the inbound actions under system policy email inbound actions. If you leave this window, there is a preview of some of the inbound actions that you can create or that have been created out of the box (reference video at 9:13).
Did you find this Background Scripts in ServiceNow article helpful? Are you ready to start your journey with ServiceNow? If you want to find out more information about GlideFast Consulting and our ServiceNow implementation services, you can reach out to us here.
About GlideFast Consulting
GlideFast is a ServiceNow Elite Partner and professional services firm that provides tailored solutions and professional services for ServiceNow implementations, integrations, managed support services, application development, and training. Reach out to our team here.