Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to Remove Work Notes from Activity Section in Service Portal?

zee15
Tera Contributor

Hi Everyone,

I have a requirement to remove Work Notes from the Activity section in the Service Portal.

zee15_0-1783660770372.png

 

I reviewed the Activity Widget, but I wasn't able to identify where the required changes need to be made.

Could someone please help me understand:

  • Which widget or component needs to be cloned or modified?
  • Where exactly should the changes be implemented to remove Work Notes from the Activity stream?
  • Are there any best practices or out-of-the-box configurations that can achieve this?

Any guidance or suggestions would be greatly appreciated.

Thanks in advance!

4 REPLIES 4

BharatC
Mega Guru

Hello @zee15 

 

1. Which widget needs to be cloned or modified
The widget responsible for displaying the Activity stream in Service Portal is:

Widget Name: Activity Stream
Widget ID: activity-stream

Since modifying OOB widgets directly is not recommended, clone the widget first by opening it in the Widget Editor and clicking Clone Widget. All your changes should be made on the cloned copy.

 

2. Where exactly to make the changes
Once you have cloned the widget, you need to modify the Server Script section of the widget. Look for the section that fetches journal field entries — specifically where it queries or filters journal_input field types.
Work Notes in ServiceNow are stored with the element name work_notes and are flagged as private journal entries (private = true). Additional Notes (Customer visible) use comments and are non-private.
In the Server Script, locate the filter that pulls journal entries and add a condition to exclude work notes:
javascript// Find and modify the filter that retrieves journal/activity entries
// Add this condition to exclude work notes
element != 'work_notes'

// Or if filtering by the private flag:
private != true
The exact variable name may differ slightly depending on your ServiceNow version, but look for an array or query block that references sys_journal_field — that is the table that stores both comments and work notes.

 

3. Also check the Client Controller
In some versions, the Activity widget also processes entries on the client side. In the Client Script section, look for any loop or filter that processes the activity data array and add a similar exclusion:
javascript// Filter out work notes on the client side as well
data.activities = data.activities.filter(function(entry) {
return entry.element !== 'work_notes';
});

 

4. Update the widget HTML (optional but recommended)
If work notes entries are being rendered with a specific CSS class or label in the HTML template, you can also conditionally hide them using an ng-if directive:
html<div ng-repeat="entry in data.activities" ng-if="entry.element !== 'work_notes'">
<!-- activity entry markup -->
</div>
This ensures nothing leaks through even if the server-side filter misses an edge case.

 

5. Replace the widget in your Portal page
After cloning and modifying, make sure your Service Portal page or record page is pointing to the cloned widget and not the original. Update this via:
Service Portal → Pages → (Your Page) → Layout — swap the OOB widget reference with your cloned version.

 

If this helps, pls click on helpful and accept solution.

Best Regards,

Bharat Chavan

Bhavya11
Kilo Patron

Hi @zee15 ,

Please go through below thread 

How to remove worknotes comments in widget

If this information proves useful, kindly mark it as helpful or accepted solution.

Thanks,
BK

zee15
Tera Contributor

Hi @Bhavya11  & @BharatC 

Thank you for your response. I was able to find a solution, and it is working as expected.

I cloned the std_ticket_conversations widget and added a condition in the HTML. Previously, the code was:

<li class="timeline-item timeline-inverted" ng-repeat="e in data.mergedEntries">
I updated it to:
<li class="timeline-item timeline-inverted" ng-repeat="e in data.mergedEntries" ng-if="e.element != 'work_notes'">

With this change, the work notes are no longer displayed, and the requirement is met. No other modifications were needed.

Hi @zee15 ,

You typically do not modify the Activity widget itself.

The Activity widget gets its entries from the Stream API ($sp.getStream() / GlideSPScriptable APIs) and the fields configured on the target table.

To remove Work Notes from the activity stream, you generally have two options.

Option 1 : Clone the Activity Widget and Filter Work Notes

var stream = $sp.getStream(table, sys_id);

if (stream.entries) {
    stream.entries = stream.entries.filter(function(entry) {
        return entry.field_name != 'work_notes';
    });
}

data.stream = stream;​

Option 2 : Create a different view in the Table for Portal that did not contain the worknotes.

So, basically this approach is the most easy option to inplement. Just create a view on the native UI for the table that you are using "portal-view"

then in that view don't add the worknotes and activity stream option and while calling the widget mention the view.

view : portal-view.

If you got the solution helpful please mark it as helpful and accept the solution to close the thread.

Regards,

Sagnic