Activity Formatter, Reply to/Forward Emails, and Email Client Template Variables

ServiceNow’s Activity Formatter, seen on virtually all task forms, typically contains the sent and received emails for a given task. This is incredibly useful for organizations that are still heavily email-based in their support model.

One of the lesser-known features is the ability to add reply, reply all, and forward buttons inline with those emails. See the bottom of this screenshot:

ServiceNow’s Product Docs page for Activity Formatter miraculously contains instructions on how to make this happen:

  1. In the navigation filter, type sys_properties.list.
  2. Add the following system property.
    • Name: glide.ui16.emailStreamResponseActions
    • Description: Add the email reply button to the activity stream.
    • Type: true | false
    • Value: true
  3. Select Submit.

This is a very helpful feature, but organizations who use it may want to change the default behavior of the reply, reply all, and forward templates that appear after clicking one of the buttons. ServiceNow includes default email client templates, though it wasn’t completely clear to me how to find them or what they were. When looking at the Email Client Template list, I always noticed the default filter:

It turns out that these email client templates control the template that is used when someone clicks the Reply, Reply All, and Forward buttons on an email in the activity formatter!

Here’s the full list of the applicable email client templates:

  • forward-received
  • forward-sent
  • reply-received
  • reply-sent
  • replyall-received
  • replyall-sent

The only mention of one of the templates (replyall-received) in Product Docs is on the Create an email client template page. There’s no mention of what these templates are for.

Let’s take a look at one of these templates: replyall-sent

The “To” field value of “recipients” seems curious to me. This doesn’t appear to be a variable we’re used to, one that’s globally defined. It’s also not in a format we’re used to, like ${recipients} or current.recipients. This must be a field on the sys_email table (note the “Table” field near the top). The same applies to the “Cc” value of “copied”. (I also assume this to mean that we could’t hard-core an email address in there.) That turns out to be exactly the case.

Given that, the use of “recipients” is interesting. “recipients” on the Email table is a combined list of all recipients on an email, joining the To and Cc together. ServiceNow might have a good reason for doing this, but it seems like it’s a mistake. Instead, I think they should have used the “direct” field/value, which would be those in the original email’s “To” field.

If we look at the replyall-received template, the To value is derived from a script, EmailClientTemplateEvaluator().getRecipientsForReplyAllEmails(). This seems to correctly use the “direct” field (plus the original sender via the “user” field in one way or another, since the original sender could be a user in the system or an email address). I’m not sure why ServiceNow would default the replyall-sent template to use the “recipients” list instead of “direct”. Perhaps there’s a good reason, but I couldn’t figure one out.

tl;dr:

  • Buttons can be added to emails in the activity formatter by setting the property “” to true.
  • The email client templates used when one of those buttons is pressed are defined in the Email Client Template (sys_email_client_template) table, but are filtered out by default if navigating from the Next Experience Unified Navigator’s “All” menu.
  • The “replyall-sent” template might use the wrong value for “To”. It might be better for this to be “direct” instead of “recipients”.

Leave a Reply