Hide Related List link on Service Portal

Nen
Tera Guru

Hi. I'm trying to hide the related list link on the Service Portal record

find_real_file.png

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:

find_real_file.png

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.

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

 

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);

View solution in original post

9 REPLIES 9

Mohit Kaushik
Mega Sage
Mega Sage

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.

 

find_real_file.png

find_real_file.png

 

Please mark this answer correct if it resolved the query and mark it helpful too if it helped you at all.

 

Thanks,

Mohit Kaushik

 

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi. Is there a way to check the role of the user by using a UI Policy? Thanks!

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

If that's the case, then I can't use @Mohit Kaushik's solution. I need to hide the related list based on the role of the current user.