Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to display Field Changes captured in Activity Stream in Portal widget ?

zaturntoshlance
Tera Contributor

These are the field changes available in Activity stream from the Instance Platform View.

zaturntoshlance_0-1665860738650.png

However, In the Portal form widget Only the Addl.Comments and Work Notes are visible. But I want to display the field changes too. How do I do it ?

zaturntoshlance_1-1665860824830.png

 

I even cloned the widget-ticket-conversation and tried to log the $sp.getStream(data.table, data.sys_id) and this method does not retrieve field changes.

zaturntoshlance_2-1665860889121.png

 

4 REPLIES 4

sieusaopolo15
Giga Sage

Hi @zaturntoshlance,

Have you found any solutions for this ? Because i'm truggle like in your case. I can't figure any way but config the server code then load the data to HTML and that's a lot work. I want to know is there a way that service portal provides but i'm missing it.

 

Have you found any solution?

josteinenge
Kilo Guru

I was trying to find a fix for the same problem. I found out that my values was stored in sys_audit_list, not sys_journal_field_list as work_notes are.

 

This is my code for retrieving field changes. Hope it helps.

 

 

var LatLngHistory = [];
var currentLat = null;

ImportOverviews.forEach(function(overview) {
var gr = new GlideRecord('sys_audit');
gr.addQuery('tablename', 'tablename');
gr.addQuery('fieldname', 'IN', 'latitude,longitude');
gr.addQuery('documentkey', overview.sys_id);
gr.query();

while (gr.next()) {
if (gr.fieldname == 'latitude') {
currentLat = parseFloat(gr.newvalue.replace(',', '.'));
} else if (gr.fieldname == 'longitude' && currentLat !== null) {
LatLngHistory.push({
lat: currentLat,
lng: parseFloat(gr.newvalue.replace(',', '.')),
sys_id: overview.sys_id, 
});
currentLat = null;
}
}
});

data.LatLngHistory = LatLngHistory;

 

Skjermbilde 2025-02-20 135858.png

 

Hi I am having this issue and this is the script I currently have. Is this where I update the sys_audit?