OBLYTECH Logo
OBLYTECH Logo

Send case replies with interaction emails

To send case replies with interaction emails, add the get_activity_of_case_and_related_interaction_for_email mail script to the Body HTML field of the reply-for-customer-service email client template. Agent replies then carry the email history from related interactions as well as the case thread. Editing the template requires the admin role.

What agents see when interaction email history is added

The script pulls the case email history together with the email history of related interactions, formats it, and places it in the email client in the agent workspace. The output is wrapped in a div with the ID collapsible-content and hidden behind ellipses, so an agent sees a collapsed block at the point of reply rather than a long run of earlier messages.

The procedure is the same in the Zurich, Australia and Brazil releases. Confirm the exact field names and layout on your own instance before you roll the change out, because customizations can change what an agent sees.

The practical reason for the change is continuity. A customer who wrote in by email, then followed up through a related interaction, usually expects the agent to know what was already said. The common failure without this setup is an agent asking the customer to repeat details that already went out in an earlier message. With the history in place, the agent can read the exchange and answer the new question directly. Explain the collapsed block to agents when you go live, because it is easy to miss the first time.

Setting up how agents send case replies with interaction emails

The procedure takes a few minutes, but there are points where first-time administrators get stuck. Follow the steps in order, and note the template name and the change date so the next administrator can trace the edit.

  1. Go to All > Email Client > Email Client Templates.
  2. Search for and select reply-for-customer-service.
  3. If a message appears about the application scope, select the link in the message so you can edit the record.
  4. Open the Content tab and find the Body HTML field.
  5. Copy the existing Body HTML content to a separate note, so you can restore it if the test goes wrong.
  6. Enter <div id=”collapsible-content”>${mail_script:get_activity_of_case_and_related_interaction_for_email}</div> in Body HTML.
  7. Select Update.

Keep the wrapper div exactly as written. Changing the ID or removing the wrapper can change how the history displays in the agent workspace, so retest after any edit to that field. If you do not hold the admin role, ask the platform administrator to make the edit, then test the result from an agent account.

If you would rather leave the default template untouched, you can create a client template and map it to the Interaction table instead. The mail script is the same in that case. Record which template carries the script so the next review of your email setup knows where to look.

Sizing the email history with two system properties

The template does not set how many emails the history contains. Two system properties control that count: number_of_activities_in_reply and include_system_emails_in_notification. The number of emails in the history matches the values set in these properties.

  • number_of_activities_in_reply sets how many activities the reply draws on. The emails in the history match the values set in these two properties.
  • include_system_emails_in_notification is the second property that sets the count. Its name suggests it controls whether system-generated emails are counted, so check on your release whether automated messages appear in the history before you settle on a value.

Read both values before you test. A test case with five emails tells you little if the property caps the history at two. After any change, run a fresh test case so the result reflects the new values.

Deciding whether agents reply directly from the case activity stream

Adding the history script is a separate choice from deciding how agents send replies. By default, agents can reply to, reply all to, and forward customer emails from the case activity stream. You can keep that default, or turn it off so agents cannot respond to customers directly from a case.

Decide this with your team before you change anything. Turning the default off changes how agents reply, not what the history contains. If the team’s replies travel through another channel, document that path and test it end to end. A reply path that has not been tested yet tends to be the first thing that breaks.

Testing the setup before agents rely on it

A useful test case has at least one email on the case itself and one or more emails on a related interaction. That lets you confirm the script reads both sources. If the case type or case fields are not yet set up, the general case management configuration covers that groundwork, so complete it first and then return here.

Send a short reply from the test case and open it in the agent workspace email client. Check four things: the history block is present, the earlier emails from the related interaction appear inside it, the count matches the two properties, and the reply text reads cleanly around the block.

Then review the message the customer receives. The history is built into the template output, so look at the rendered message as well as the agent view, before you rely on the setup for live customers. Keep the test record with the date and the property values, so you can compare results after the next change.

If the test reply looks wrong in a way the checks above do not explain, restore the Body HTML content you copied before the edit, then rerun the test. That is the reason to keep the copy and the change date together in your note. Make one change at a time, so you can tell which edit produced a given result.

Routing email interactions so the history has material to show

History adds value when the right email interactions reach the case in the first place. Email interactions reach agents through Advanced Work Assignment (AWA). The Email service channel is created when you install Email Interaction for CSM, so confirm that channel exists before going further.

Then set up the three pieces AWA uses to assign email work: a queue, an assignment rule and an agent group. Where your design allows, route one customer’s related emails to the same agent group, so the history block supports continuity rather than introducing a new person to the thread. If your team uses a third-party platform for routing, the guide to routing email interactions through a CCaaS platform covers that setup. For the queue, rule and group settings on the ServiceNow side, see the page on assigning emails to agents.

For help planning this work, see ServiceNow implementation.

Questions about history in replies, notifications and routing

Can the same history appear in notification emails?

Yes. You can add a mail script to email templates so that replies and notifications include the full activity on a case, including emails from related interactions. Which template you edit depends on which messages you want to change. Review the notification and reminder settings for email interactions first, so you know which messages your setup sends.

What changes for agents if replies from the case activity stream are turned off?

Agents can no longer reply to, reply all to or forward customer emails from the case activity stream. Confirm which reply path your agents will use instead, and test that path with the same case and related interaction you used for the history test.

Why does the history look shorter than I expected?

Work through four checks in order. Confirm the two system properties hold the values you intended. Confirm the related interactions are actually attached to the case, since the script draws its history from those. Confirm the Body HTML edit saved and the wrapper div is intact. Then run a fresh test case. Work through these before changing anything else, so you do not change a setting that turns out not to be the cause.

Who should hear about the change before it goes live?

Tell the agents who will read these replies, the supervisors who review them, and whoever owns the notification templates. Agents need to know that the history sits in a collapsed block and that they can read the earlier emails in it before they answer. Supervisors need to know the reply now carries more context, so they can check that quoted history does not clutter a short answer. Give the wrapper div warning to whoever edits email templates next, since that is the change more likely to break the display without anyone noticing.

Does routing change what the history contains?

The script itself has no routing setting. Routing decides which email interactions reach agents and attach to a case. The history then draws on the related interactions that exist on that case, so a routing change can alter the history indirectly by changing what arrives.