How to view the Resolution Notes in Service Portal Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 01:56 AM
I have one doubt in Service Portal. When an end user creates and Incident it is submitted and agent starts working on that ticket.
Additional comments added by the agent gets captured on the ticket form. But once the agent marks the Incident as resolved how will it get captured on the Ticket form in Service Portal.
I can't able to view the resolution notes in the form in Service Portal.
Because end user must want to view the resolution notes/close notes.
Can anyone let me know on the same.Its bit urgent fo rme to implement.
Thanks,
SNOW@Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2018 06:18 AM
Instead of var fields = $sp.getFields(gr, 'number,state,priority,sys_created_on');
Please use : var fields = $sp.getFields(gr, 'u_close_code,close_notes');
You can select the fields you want

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-05-2019 12:26 PM
Hello,
Wanted to share a solution I have developed that has been working great so far. I cloned the conversations widget and customized server script only.
I created a custom function 'getStreamWithResolutionNotes' as follows:
function getStreamWithResolutionNotes() {
//Refresh the history set
if(typeof GlideHistorySet != 'undefined')
GlideHistorySet(gr).refresh();
else
Packages.com.glide.audit.HistorySet(gr).refresh();
var stream = $sp.getStream(data.table, data.sys_id);
for(var i = 0; i < stream.entries.length; ++i) {
var hist = new GlideRecord('sys_history_line');
hist.get(stream.entries[i].sys_id);
stream.entries[i].sys_id = hist.getValue('audit_sysid');
}
var entry = {};
var audit = new GlideRecord('sys_history_set');
audit.addQuery('table', data.table);
audit.addQuery('id', data.sys_id);
audit.orderByDesc('last_update_recorded');
audit.query();
if(audit.next()) {
var auditLine = new GlideRecord('sys_history_line');
auditLine.addQuery('set', audit.getUniqueValue());
auditLine.addQuery('field', 'IN', data.fields.toString());
auditLine.orderByDesc('update_time');
auditLine.query();
while(auditLine.next()) {
entry = {
'sys_created_on_adjusted' : auditLine.update_time.getDisplayValue(),
'sys_id' : auditLine.getValue('audit_sysid'),
'login_name' : auditLine.getValue('user_name'),
'user_sys_id' : auditLine.getValue('user'),
'intials' : buildInitials(auditLine.getValue('user_name')),
'sys_created_on' : auditLine.getValue('update_time'),
'field_label' : data.fieldLabels[auditLine.getValue('field')],
'name' : auditLine.getValue('user_name'),
'value' : auditLine.getValue('new'),
'element' : auditLine.getValue('field')
};
stream.entries.push(entry);
}
stream.entries.sort(function(a, b) {
var gdtA = new GlideDateTime(a.sys_created_on);
var gdtB = new GlideDateTime(b.sys_created_on);
return gdtB.compareTo(gdtA);
});
}
return stream;
}
Then I replaced the line
data.stream = $sp.getStream(data.table, data.sys_id);
with
data.stream = getStreamWithResolutionNotes();
Additionally, I copied the 'buildInitials' function that exists in the client script OOB, into the server script since I called it in my custom function.
I also added the following near the beginning of the server script. You could modify this later if there are any other fields that you wish to capture on the conversation:
data.fields=['close_notes'];
data.fieldLabels = {
'close_notes' : 'Resolution Notes'
};
I added the new widget to the ticket page, and it captures the comments, work notes attachments, as well as the close notes all in the correct timeline. Working great so far. Attached my widget code. One thing I did find, is that you have to do this in global scope. The widget breaks if you clone in a scoped app.
Update: 10/1/2019 - I had to make a few updates since this initial post. Most notably I had to make the "GlideHistorySet.refresh()" call because of the way history sets work in ServiceNow. However, we have had the attached widget code on our production instance for the last several months and it is working great!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-20-2020 12:18 PM
I'm going down a similar road, but one thing the history doesn't seem to get you is the attachments. Did you happen to come up with a solution to that? We could query the attachments table to get the records, but getting the order right is going to be a bit of a PITA?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2020 05:34 PM
I think attachments already work OOB? This function is merging history into the object returned by
$sp.getStream()
which, while undocumented as far as I know, does appear to return attachments by inspection. Its been a while since I developed this, but let me know if you run into any issues with not seeing the attachments in the stream on this widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2020 12:58 PM
Hey Chris,
When I try to upload the XML attached onto the latest NY Patch, it doesn't show up in my retrieved update set list. Would you be able to possibly iterate out what code was modified between your original post and current so I can manually test?
Thank you.