Field Changes in Activity Stream in Portal

debendudas
Mega Sage

Hi Team, is it possible to show the Field Changes in the Activity Stream of Portal? 

debendudas_0-1746195512946.jpeg

4 REPLIES 4

Rajesh Chopade1
Mega Sage

Hi @debendudas 
ServiceNow doesn’t provide a default option to show field changes in the Activity Stream, you can customize this functionality using widgets and the sys_audit table. This method allows you to display field changes in the Activity Stream or another relevant part of your portal.

I hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.

thank you

Rajesh

Thanks for your replying Rajesh.

 

Do you have any sample script or example?

hi @debendudas 

 

You can create new 'widget' and use bellow server script & client script:

server script :

var gr = new GlideRecord('sys_audit');
gr.addQuery('document_key', current.sys_id);  // For a specific record
gr.orderByDesc('sys_created_on');  // Sort by most recent changes
gr.query();

var changes = [];
while (gr.next()) {
    var change = {
        fieldName: gr.fieldname,
        oldValue: gr.old_value,
        newValue: gr.new_value,
        timestamp: gr.sys_created_on
    };
    changes.push(change);
}

data.fieldChanges = changes;  // Pass the changes to the widget client

 

client script code:

// Display the field changes in the widget template
data.fieldChanges.forEach(function(change) {
    var changeText = change.fieldName + ' changed from ' + change.oldValue + ' to ' + change.newValue;
    // Append changeText to your HTML or Activity Stream view
});

 

 

Gaurav Rathaur
Kilo Guru

Hi! @debendudas,  By default, Field Changes (also known as audit records) in ServiceNow are not shown on the portal's activity stream (e.g., in Service Portal or Employee Center). Only Comments and Work Notes are typically included.

However, yes—it is possible to show field changes in the portal activity stream by customizing the widget logic.

Here’s how you can do it:

Option 1: Customize the Ticket Conversations or Activity Stream widget

  1. Navigate to the Service Portal > Widgets.

  2. Look for the widget used for showing activities (e.g., Ticket Conversations, Activity Stream, or a custom one).

  3. Edit the widget's server script to include sys_audit records.

  4. Merge the audit records into the same data array as comments/work notes with proper formatting.

Option 2: Create a custom script in a widget or portal page

Fetch and display data from the sys_audit table filtered by:

  • documentkey = the record sys_id

  • Fields of interest (like state, priority, assigned_to, etc.)

Format the display for readability and show it alongside comments/work notes.


Key Table Info:

  • Table: sys_audit

  • Fields: fieldname, oldvalue, newvalue, sys_created_on, sys_created_by, documentkey

If my response helped please mark it correct and close the thread so that it benefits future readers.