- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 09:15 PM
Hi. I'm trying to hide the related list link on the Service Portal record
I'm on a scoped app and I've tried creating a Client Script but I can't seem to make it work on the portal:
I want to hide the related list if the user doesn't have the role needed. The role check is successful since I've been seeing the alert. And when I set the UI Type to Desktop, I saw that the related list was hidden.
The user doesn't have an access to the table so they wouldn't see the records but the Requester wanted to hide the link as well.
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2020 09:44 PM
this should work, seems like you did not pass the correct table name of related list as well has the second parameter should be true , no quote need to be there.
to get table name of related list >> go to native ui , open the form>> related list >> right click on column >> list control and then you will see "related list" field , just copy the name and use it in below script.
eg: i tested to hide the task sla related list
g_form.hideRelatedList('task_sla.task',true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 09:55 PM
Hi There,
Did you try creating UI policy?
You can hide related lists easily with the helo of UI policy. There is a related list on UI policy which works as action on related lists in all type of forms. There you can create a new action to hide the related list and condition you can provide in your script part of UI policy.
Please mark this answer correct if it resolved the query and mark it helpful too if it helped you at all.
Thanks,
Mohit Kaushik
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 10:27 PM
Hi. Is there a way to check the role of the user by using a UI Policy? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 11:34 PM
Hi,
UI policy will only help you create condition based on fields on table; you cannot check for roles in the condition field; for that client script is required
For example: if you can check to check caller of incident has itil role this can be done using UI policy by dot walking to caller_id field and then roles field but if you want for logged in user then it is not possible to check role via ui policy
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2020 11:50 PM
If that's the case, then I can't use