Extending the Customer History Tab to Use Any Reference Field on a Case

SivaniG
Giga Guru

Overview

The Customer History tab in Customer Service Management (CSM) Workspace provides agents with a consolidated timeline of customer-related activities and interactions.

Out of the box, Customer History resolves context using the standard Consumer, Account, and Contact fields available on the Case record. As a result, records related through custom reference fields are not automatically displayed in the timeline.

This article explains how to extend Customer History so that activity can be surfaced from any custom reference field on the Case form. In the example used throughout this article, the custom reference field is task_for, which references the User table. The same approach can be applied to any other reference field.

 

Solution Architecture

The Customer History framework relies on Activity Subscription configurations. When records satisfy the conditions defined in an Activity Context, ServiceNow generates corresponding entries in the sn_actsub_activity table. The Customer History tab then reads from this table and renders the records as timeline entries.

The overall flow is:

Case Record Activity Context Activity Type sn_actsub_activity Customer History Timeline

By configuring a custom Activity Module, Activity Context, Activity Type, and related components, activity associated with any reference field can be displayed within Customer History.

The Customer History tab in Customer Service Management (CSM) Workspace provides agents with a consolidated timeline of customer-related activities and interactions.

Out of the box, Customer History resolves context using the standard Consumer, Account, and Contact fields available on the Case record. As a result, records related through custom reference fields are not automatically displayed in the timeline.

This article explains how to extend Customer History so that activity can be surfaced from any custom reference field on the Case form. In the example used throughout this article, the custom reference field is task_for, which references the User table. The same approach can be applied to any other reference field.

 

Solution Architecture

The Customer History framework relies on Activity Subscription configurations. When records satisfy the conditions defined in an Activity Context, ServiceNow generates corresponding entries in the sn_actsub_activity table. The Customer History tab then reads from this table and renders the records as timeline entries.

The overall flow is:

Case Record Activity Context Activity Type sn_actsub_activity Customer History Timeline

By configuring a custom Activity Module, Activity Context, Activity Type, and related components, activity associated with any reference field can be displayed within Customer History.

 

Configuration Steps

Step 1 — Create an Activity Module

Navigate to: Activity Subscription > Configuration > Modules

The Activity Module is the central configuration record that holds all settings for your custom history. Create a new module — this is the container that all subsequent configurations will reference.

SivaniG_0-1781005062693.png

Step 2 — Create a Variant of the Customer History Tab

From the ui builder find the oob customer history page collection create a new variant

A Variant tells the system under which conditions your module activates, and ties it to the OOB Customer History tab.

Configure the following on the Variant:

Table Condition — Specify which table this Variant applies to (e.g., the Case table or your custom table).

SivaniG_1-1781005100316.png

SivaniG_2-1781005117261.png

Screen Condition Script — This script controls visibility. The Variant — and therefore the entire custom Customer History section — only appears when the task_for field is populated on the Case form:

SivaniG_3-1781005133298.png

This ensures the custom tab variant is only rendered when task_for has a value. When the field is empty, the variant stays hidden.

 

Activity Module Parameter — Paste the sys_id of the Activity Module created in Step 1 into this field. This links the Variant back to your module.

Step 3 — Create an Activity Context

Navigate to: Customer Central > Customer History > Activity Contexts

The Activity Context defines from which table the history records will be pulled. Since task_for references the User table in this example, you configure the context to query that table.

Create the Activity Context inside your custom module (via the module's related list or by referencing the module on the context record).

SivaniG_4-1781005156043.png

Step 4 — Create an Activity Type

Navigate to : Customer Central > Customer History > Activity Types

The Activity Type is where you define exactly what data gets surfaced in the timeline. Configure the following fields:

SivaniG_5-1781005170522.png

Field

Purpose

Activity Message

The message template displayed for each activity entry in the timeline

Verb

The action label (e.g., "created", "updated") shown alongside the activity

Activity Source

The table from which history is pulled (your custom table or the referenced table)

Actor

The specific field in that table whose value identifies the relevant user or entity

Actor Field Mapping

Maps the Actor field's value to the User table via sys_id, so the timeline correctly associates the record to a person

Filter Conditions

The conditions that determine which records from the source table are included in the activity feed

 

Step 5 — Create an Activity Group

Navigate to: Customer Central > Customer History > Activity Types.

The Activity Group is a logical grouping that organizes one or more Activity Types under a common label in the Customer History timeline. This is what agents see as a section header when browsing history.

SivaniG_6-1781005185778.png

Create one Activity Group Type from created Activity Group Related List and attach the Activity Type into the Activity Group Type.

SivaniG_7-1781005200023.png

Step 6 — Create an Activity Type Template

Within the Activity Group Type, create an Activity Type Template.

The template controls the visual presentation of each record card in the timeline:

  • Icon — Choose an icon that represents this type of record visually in the timeline
  • Activity Type Template Fields — Define which fields from the source record are displayed on each card. Add one field entry per field you want visible to the agent

SivaniG_8-1781005216138.png

Step 7 — Associate Activity Type and Activity Group with the Activity Context

Go back to your Activity Context and from the Activity Context Group related List add the Activity Group created in step 5 and Activity Context Types related list, add the Activity Type created in Step 4.

 

Step 8 — Create an Activity Facet

Navigate to: Activity Context (you created)> FACETS (Related list).

Facets define the filter options that appear under the filter icon in the Customer History tab. Each Facet corresponds to one category of activity, letting agents toggle specific record types on or off in the timeline.

SivaniG_9-1781005231254.png

Facet Group defines under which group your activity can be shown

SivaniG_10-1781005245204.png

 

End Result

Once all steps are complete, here is what happens at runtime:

  1. An agent opens a Case where u_fleet_member field is populated
  2. The screen condition script evaluates to true, making the custom Variant visible
  3. The Activity Context queries the configured table using the Activity Type's filter conditions
  4. Records that match are written to the sn_actsub_activity table, tagged to that case
  5. The Customer History tab reads from sn_actsub_activity and renders each matching record as a timeline card, using the Activity Type Template for display
  6. Agents can use Facets to filter activity types independently, allowing them to focus on specific categories of records.
0 REPLIES 0