0% found this document useful (0 votes)
116 views14 pages

Inbound Email Action Overview

Upload
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views14 pages

Inbound Email Action Overview

Upload
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

ServiceNow Developer

ServiceNow Implementation Development Guide.


Inbound Email Action

Sangeeta Yadav-5082021a8
www.linkedin.com/in/sangeeta-yadav-sy02
Content

01 What is Inbound Email


Action

02 Parsing inbound Email

03 Identifying the Sender

04 Inbound Email Action Form

05 More Info

Sangeeta Yadav-5082021a8
What is Inbound Email Action?
Inbound email is mail sent from any user into ServiceNow. ServiceNow parses the incoming email and may or may not
take action in response.
Define an inbound email action to script how the system responds to an inbound email.

When email is received, ServiceNow needs to determine:


• If the message is a reply, forward, or new message
• If there is an existing record associated with the message
• If the sender is a known user

Note: Inbound email flows take priority over inbound email actions. If you create flows with inbound email triggers,
emails are first processed by the inbound email triggers before they are processed by inbound email actions.

Sangeeta Yadav-5082021a8
Parsing Inbound Email
When email is received, ServiceNow parses the email and populates the properties on the global email
variable.

• email.to: Contains a comma-separated list of email addresses in the To: and Cc: fields.
• email.direct: Contains a comma-separated list of email addresses in the To: field.
• email.copied: Contains a comma-separated list of email addresses in the Cc: field.
• email.body_text: Contains the body of the email as a plain text string.
• email.body_html: Contains the body of the email as an HTML string.
• email.from: Contains an email address that depends on the following conditions:
If the address listed in the email Headers field matches an existing user's Email address, this variable contains the
user's email address.
If the address listed in the email Headers field does not match an existing user's Email address, this variable contains
the address listed in the email Headers field.
• email.from_sys_id: Contains the Sys ID of the user who sent the email to the instance.
• email.origemail: Contains the email sender's address as listed in the email Headers field.
• email.subject: Contains the email's subject as a plain text string.
• email.recipients: Contains a comma-separated list of recipient addresses.
• email.recipients_array: Contains the recipient addresses as an array.
• email.content_type: Contains the MIME content type of the email (for example,text/plain; charset="us-ascii" or text/html;
charset="us-ascii").
• email.headers: Contains details about the sender, route,
Sangeetaand receiver as a plain text string in the format of the sending
Yadav-5082021a8
Sangeeta Yadav-5082021a8
Identifying the Sender
ServiceNow parses the sender of the inbound email into the email.from property and attempts to match the
email address to a record in the User [sys_user] table.

If a match is found:
• ServiceNow impersonates the user when taking action in response to the email.
• Scripts have access to the user's information through the GlideSystem methods such as gs.getUserName().

If no match is found:
• If automatic User creation is enabled, Users are created automatically and then impersonated.
• If automatic User creation is disabled, the user Guest is impersonated.
Sangeeta Yadav-5082021a8
Inbound email actions define what actions ServiceNow takes in response to incoming email.

• Is the message a reply or forward?


• Does the message match a record in the database?
• Does the message match the conditions?

Reply, Forward, or New?


The first step is to determine if the message is a reply, forward, or new message. ServiceNow searches the subject line of the
incoming message for prefixes indicating reply or forward. To set the prefixes, use the All menu to open System Mailboxes >
Administration > Email Properties. Set the reply and forward prefixes in the Inbound Email Configuration using a case-
insensitive, comma-separated list. Setting the prefixes is ordinarily a system administrator function and not an application
developer function.

Sangeeta Yadav-5082021a8
Inbound email receive types
The system classifies all incoming email into one of three types: forward, reply, or new.

Order Type Criteria


1 Forward The system classifies an email as a forward only when it meets all these criteria:
- The subject line contains a recognized forward prefix such as FW:.
- The email body contains a recognized forward string such as From:.
The system classifies any email that meets these criteria as a forward, even if the message
contains a watermark or record number that otherwise classifies it as a reply.
2 Reply The system classifies an email as a reply when it fails to match it to the forward receive type
and it meets any one of these criteria:
- The subject line or email body contains a recognized watermark such as Ref:MSG0000008.
- There is no watermark and the Reply-To header contains a recognized message ID of an email
with a target record.
- There is no watermark and the subject line contains a recognized reply prefix such as RE: and
a recognized record number such as INC0005574
3 New The system classifies an email as new when it fails to match it to the forward and reply receive
types.

Sangeeta Yadav-5082021a8
Watermark/Record Number
If an inbound message is recognized as a reply or forward ServiceNow attempts to match the incoming email with an existing
record by looking for a unique watermark in the subject line or message body. By default, watermarks are inserted as the last
line of outbound messages.

If no watermark is found, ServiceNow searches the subject and body


for a record number.

Conditions
The final step to determine which Inbound Action executes is to check
the conditions for a match. Use the Condition builder to create the
condition or write a Condition script. If there is no value in a condition
field, the field returns true.

Inbound Email Actions execute only when:

• The incoming email type matches the inbound action type


• The watermark or record number matches a record on the target
table
• The inbound action Conditions evaluate to true

Sangeeta Yadav-5082021a8
Sangeeta Yadav-5082021a8
Inbound Email Action Form

The table where records are created or updated.

Choose Record Action to modify a database record or


Reply Email to send an email. Select this option to stop processing after this
inbound email action runs.

Required roles: Specify roles the sender


must have to trigger the inbound action.

From: Select the user required to run the action. If a user is selected,
the action runs only when the email sender matches the user name.
Leave this field blank to perform the action for all users.

Conditions: Use the Condition Builder to specify the condition required to run the Inbound Action.

Condition: Write a server-side script to specify the condition required to run the Inbound Action.

Sangeeta Yadav-5082021a8
Actions Section
Field actions: Specify values to update in the record. Can use values parsed from
the incoming message.

Script: A server side script defining what


action(s) to take.

The script field has access to:


• current: The current record from the Target table created with the inbound action.
• event: For inbound actions parm1 is the record number and parm2 is the user name.
• email: Populated when the inbound email is parsed: email.subject, email.from, etc. This object has no properties which are
methods.
• logger: Use the logger.log() method to write to the system log.

When scripting, remember to call the current.update() method to update the record in the database.
Sangeeta Yadav-5082021a8
More Info
Inbound Email Actions process inbound email
Respond to email replies and forwards
Can also respond to New messages

Inbound Action scripts are server-side scripts which have access to:
• current
• event
• email
• logger

Use the System Mailboxes modules to determine if email is sent, received, or skipped

Create mailto Email Templates to pre-populate reply messages

Sangeeta Yadav-5082021a8
THANKS
SERVICENOW

Sangeeta Yadav-5082021a8
www.linkedin.com/in/sangeeta-yadav-sy02

You might also like