Updated Worknotes visibility for specific group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2025 01:03 AM
I have a requirement that a specific group can only see the worknotes in activity logs which has been added by their group not by other groups, How can I implement this, any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2025 01:15 AM
try to create field level READ ACL on work_notes and use script to control the visibility
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2025 01:20 AM
something like this in field level READ ACL with advanced script
// get logged in users group
var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
// get the members for those groups
var groupMembersArr = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", 'IN', groups.toString());
gr.query();
while (gr.next()) {
groupMembersArr.push(gr.user.user_id.toString());
}
// check if work notes is added by any 1 member of the group to which logged in user belongs
var journalRec = new GlideRecord("sys_journal_field");
journalRec.addEncodedQuery("element=work_notes^element_id=" + current.getUniqueValue());
journalRec.addQuery('sys_created_by', 'IN', groupMembersArr.toString());
journalRec.setLimit(1);
journalRec.query();
answer = journalRec.hasNext();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2025 09:23 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-01-2025 02:31 AM
create a custom business rule on the Task table. and use condition
if(current.work_notes && current.getValue('group') !== gs.getUser().getGroupName()){
current.work_notes = '';
}
then, create ACL on work_notes.
set conditions to allow access only if the user's group matches the group of the worknote. use script include or client script a script to filter worknotes dynamically on form load or save