jonnyseymour
ServiceNow Employee

In my past blog posts I have discussed Two watermarks in incoming Email messages,  and Email Notification dependencies to their 'Sys version' and 'Content type' fields, now I will cover what happens when "null" appears on your incoming messages marked as Reply. This is quite common on custom tables where the 'number' field does not exist.

null_1.png

null.png

Incoming emails classified as reply

Incoming emails can be classified as new, reply or forward based on a set algorithm.

Incoming email can be classified as a Reply because there is a matching watermark (e.g Ref:MSG000001) in the subject or the body message. Be aware that other options exist (e.g. the In-Reply-to header, the reply prefix, etc).

When our mail process matches a reply email with a watermark, the email logs will show a message for the matching record. Here is an example:

For a reply email that matches an record the incident table, the reply looks like:

> Received id=<D24D4975.3646> Classified as reply to 'INC0000001' via watermark 'Ref:MSG0000568' in message

As you can see, it will correctly display a value.

By default, the Number field is the display value for all task tables.

However, on my u_test_01 table, the replies looks like:

> Received id=<D24D4974.3646> Classified as reply to 'null' via watermark 'Ref:MSG0000567' in message

After some review, the mail process classifying as reply is searching for the column name 'number' (<target>.number). If it is not defined, it is shown as "null."

Incoming email logs are the important to understand the behavior of inbound email actions. They are visible on the 'Inbox' view on the email table. If you see "null" on your incoming messages classified as reply, just ignore the null message. The mail process is working just fine.

The message reads Received id=<ID> Classified as reply to '<NUMBER>' via watermark 'Ref:<WATERMARK>' in message

Example to demonstrate the dependency with the 'number' field

I have created an example with two cases to validate why some incoming email logs are showing "Classified as reply to 'null' via watermark 'Ref:MSGxx' in message" (or subject). I created a new table, a new notification and a new inbound action.

I've created a simple u_test_01 table with the following fields:

Field #1

Field #2

Type

String

Type

String

Column name

u_string01

Column name

u_string02

Max length

40

Max length

300

Display

CHECKED

On any table, if the field with the attribute 'Display' set to true (checked), the field "value" is the the information that other tables will display when referenced to this record.

Note the behavior with display fields:

Display field value

Reference field shows as

Area of confusion

This is an example

This is an example

It looks like a String. Only the underscore   distinguish them as reference fields

(empty)

(just blank)

It looks like the field is NULL. Some applications will return "null" as the display value

NULL

(just blank)

It could look like not defined

  (just blank characters)

    (it looks just blank)

It looks like the field is NULL

Sys_id of the reference does not exist

(just blank)

It looks like the field is NULL

Here is how it looks on the 'Test 01' table created for this example:

2015-10-22_1008-null-001.png

Then, I have created a email notification 'u_string01 notifications', that fires when u_string01 changes:

Name

=

u_string01 notifications

Table

=

u_test_01

Inserted

=

checked

Updated

=

checked

Conditions

=

u_string01 Changes

Users

=

Jxxx@xxx.com

Subject

=

Test u_string01

Body

=

Test u_string01

Finally I have created a simple inbound action as follow:

Name

=

u_test_01_update

Table

=

u_test_01

Type

=

Reply

Condition

=

current.getTableName() ==   'u_test_01'

Script =

// This entry is to force a change on the record.

// If you set a field to the same value or make no changes,

// it will not execute update()

current.u_string_02="this have been updated from: " + sys_email.sys_id;

// This update is required to get target set on the incoming email.

// If no update happens, target is (empty)

current.update();  

//Logging the execution while developing. Remove on production

gs.log("u_test_01_update action executed", "EMAIL." + sys_email.sys_id);

Running the first CASE:

Tables without the 'number' field will display 'null' on the email logs

Note we have not added the 'number' field in the table yet.

When we received a reply email with Ref:MSG0000702 watermark in the subject, logs will show:

> Received id=<D24D4974.3646> Classified as reply to 'null' via watermark 'Ref:MSG0000702' in subject

> Processed 'u_test_01_update', updated u_test_01 :TEST01

2015-10-22_1008-null-004.png

The message "updated u_test_01 : TEST01" means the target is set to the matching record for the incoming reply message (otherwise it is empty). Again, no updates mean a target will be empty (see above for the "behavior with display fields")

2015-10-22_213-target.png

Running the second CASE:

Tables with the 'number' field will display the 'number' value on the email logs instead of the display value.

To execute the second test, I created a new field on the form with column name 'number':

Field #3

Type

=

String

Column name

=

number

Max length

=

40

Then updated the same data with 'number' = "NUMBER01."

2015-10-22_1008-null-005-with-number.png

After I sent the reply email to the instance with Ref:MSG0000702 in the email body, the logs showed:

> Received id=<D24D4975.3646> Classified as reply to 'NUMBER01' via watermark 'Ref:MSG0000702' in message

> Processed 'u_test_01_update', updated u_test_01 :TEST01

2015-10-21_1218-Watermark-null-06-correct-message.png

As you can see, it will correctly display a   value and it is the 'number' column. By default, the Number field is the display value for all task tables.

  • The column named "number" can only be created by ServiceNow developers.
  • Regular developers creating "number" will see the column renamed as u_number.
  • If you extend from task, you will inherit the number field and it will show correctly on the incoming message.
  • If you see "null"on your incoming messages, just ignore the message because the mail process is working just fine.

Our mail process searches for the number field on that target table to display classified as reply to '<target.number>' via watermark. I tested this example in Fuji using Chrome as my internet browser. I was able to successfully set a Display value on a table, determine why a target shows up as empty, and how "null" appears on an incoming email.

More information can be found here:

Thanks joaorodrigues

1 Comment