Activities on Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2022 11:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 07:19 AM
Hi,
I'm looking to do the same in our portal. Did you get a chance to figure out how to add additional fields to the log? Any help would be much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 12:24 PM
We were able to create a custom widget to capture the activity log. Basically you need to query the History Set and History Set Line tables and then parse out the data. You can start it out like this:
new GlideHistorySet(table, sys_id).generate();
var stream = [];
var gr = new GlideRecord("sys_history_set");
gr.addQuery("table", table);
gr.addQuery("id", sys_id);
gr.addQuery('domain',domain);
gr.addQuery('date_format',date + ' ' + time);
gr.addQuery('time_zone',timezone);
gr.addQuery('language',language);
gr.orderByDesc("sys_created_on");
gr.query();
while(gr.next()){
var grl = new GlideRecord("sys_history_line");
grl.addQuery("set", gr.sys_id);
grl.addQuery("field", "IN", gs.getProperty('glide.ui.' + table + '_activity.fields'));
grl.orderByDesc("update_time");
grl.query();
while(grl.next()) {
//GET YOUR AUDIT DATA HERE
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 02:01 PM
Thank you!
May I ask how you are listing the results? Is it a string field that you added to the table?