How to hide the Post Incident Review Related list based on Role?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello Everybody,
I want to hide the related list "Post Incident Review" in incident form based on a role "major_incident_manager'.
So only Major Incident Managers can only see the tab in both UI and in the Service Operations Workspace.
I can't see the Related list name to write a OnLoad Client Script with the sys_id, can someone help me on this?
UI Backend:
Workspace:
This is OOTB behavior but we want to customize it so that only Major Incident Managers can see those tabs in both UI and workspace? please help me on this
Thanks in Advance!
Thanks,
Sattar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
did you debug the client script by adding alert?
if it's going inside that IF then it means it should hide unless the related list name is wrong
function onLoad() {
if (!g_user.hasRole('major_incident_manager')) {
alert('now hiding related list');
g_form.hideRelatedList('sn_sow_inc_post_incident_review.incident_ref');
}
}
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you for marking my response as helpful.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
To make it work for workspace there is a long path involving UI builder and duplicating the Record page variant
I will suggest to avoid this much customization due to technical debt and maintenance.
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Shaik Sattar ,
You are doing it right but a small change. Use something like below.
function onLoad() {
if (!g_user.hasRole('major_incident_manager')) {
g_form.hideRelatedList('sn_sow_inc_post_incident_review.incident_ref');
}
}This script will hide the related list, if the users don't have the role "major_incident_manager".
-Dhanraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
@Ankur Bawiskar , @Dhanraj B thank you
