Query comments from sys_journal_field for Requested Item has read access to admin only why ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Why is a user who has commented on a Requested Item unable to query and view their own comments in a custom widget, while only admins are able to see all comments? Additionally, I’d like the user who initiated the Requested Item to be able to view all related comments and activity within the custom scoped application. Below is the code snippet I’m using. Any guidance or suggestions would be greatly appreciated.
function populateComments(ritmId) {
try {
var journalGR = new GlideRecordSecure('sys_journal_field');
journalGR.addQuery('element_id', ritmId); // RITM sys_id
journalGR.addQuery('element', 'comments'); // Only comments field
journalGR.orderByDesc('sys_created_on'); // Latest first
journalGR.query();
var parsedComments = [];
while (journalGR.next()) {
parsedComments.push({
author: journalGR.sys_created_by.toString(),
time: journalGR.sys_created_on.getDisplayValue(),
comment: journalGR.value.toString()
});
}
data.viewData.comments = parsedComments;
} catch (error) {
gs.error('Error in populateComments: ' + error.message);
data.viewData.comments = [];
}
}
0 REPLIES 0