Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

Hide "Related" Tab on Forms in UI for non-Admin Users

(0) ShareShare
ReportReport
Posted on by 20

Hello CRM superstars! 

I am looking for a way to hide the "Related" tab on entity forms for non-Admin users (i.e., specific security roles). 

I understand that I can remove all relationships directly from the form customization window (Solution>Entity>Forms>Main Form>Navigation in "Home" tab), and I understand that I can also edit the relationship between two entities directly (Solution>Entity>Relationships>Specific Relationship, then select "Do not Display" as Display Option under "Navigation Pane Item for Primary Entity").

Also, I know that I can make it completely disappear from view if I edit form properties and uncheck "Show Navigation Items" in Page Navigation under Display tab. I do not want to completely hide it for everyone, because sys admins need to access Audit History for records.

We already had to customize certain aspects of the form (for example, show/hide other tabs based on current user's assigned Security Roles), so we got that part of the code down at least. 

I am wondering if there is a way to do the same for the "Related" tab (hide it for users who are not Sys Admins so that the regular users do not see it if there is nothing there for them to look at).  

Just as an FYI, large majority of our entities, views, attributes, apps, relationships are custom. we have Dynamics 365 on-prem, Version 1612 (9.0.24.8) (DB 9.0.24.8). 

Thank you kindly for your suggestions! 

  • Wahaj Rashid Profile Picture
    11,321 on at
    RE: Hide "Related" Tab on Forms in UI for non-Admin Users

    Hi,

    Hiding the Related tab (fully) is not possible, the only way is to copy the form and have different versions (as mentioned earlier).

    If any of this approach helps, mark the appropriate answer as verified (Select Yes under 'Did this answer your question?').

  • sofijak Profile Picture
    20 on at
    RE: Hide "Related" Tab on Forms in UI for non-Admin Users

    Hi Wahaj, thanks for replying! I am advocating for this approach with my users, but they were still eager to find a solution that hides the entire tab based on security roles, not just the items within the tab. I think your approach with two different forms is interesting - we have a lot of entities to deal with, but it is a low-code option at least!

  • Suggested answer
    Wahaj Rashid Profile Picture
    11,321 on at
    RE: Hide "Related" Tab on Forms in UI for non-Admin Users

    Hi,

    I have another approach in my mind.

    We can't hide this tab programmatically, but we can hide the Navigation Items under this tab.

    We can loop through, formContext.ui.navigation.items collection and call setVisible function to hide all of these.

    This will make sure, when a Non-Admin user clicks on Related tab, there are no options listed to navigate:

    pastedimage1618525669230v1.png

    Here is the sample code:

    // Register on Load of the Form, pass execution context as first parameter
    function onLoad(executionContext) {
    
        // Get Form Context
        const formContext = executionContext.getFormContext();
    
        // Get Navigation collection
        const navigations = formContext.ui.navigation.items;
    
        // Get User Roles
        const userRoles = Xrm.Utility.getGlobalContext().userSettings.roles;
    
        // Verify if User is Admin
        const isAdmin = isAdminRole();
    
        // If not Admin
        if (!isAdmin) {
    
            // Hide all related tabs
            navigations.forEach(function(item) {
           
                item.setVisible(false);
            });
    
        }
    
    }

    I have blogged the solution in detail here:

    Dynamics 365 CE: Hide Related Tab based on Security Role | CRM Logs (wordpress.com)

  • Suggested answer
    Wahaj Rashid Profile Picture
    11,321 on at
    RE: Hide "Related" Tab on Forms in UI for non-Admin Users

    Hi,

    Thank you for your query.

    One way is to copy your form (Save as) to create a new one, and uncheck "Show navigation items".

    Enable forms based on the Security Roles, for example:

    • Enable form with Related tab only for System Administrators.
    • Enable form without Related tab to Normal users.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 89

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 78 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans