web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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! 

I have the same question (0)
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    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.
  • Suggested answer
    Wahaj Rashid Profile Picture
    11,323 on at

    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)

  • sofijak Profile Picture
    20 on at

    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!

  • Wahaj Rashid Profile Picture
    11,323 on at

    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?').

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 62 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 43

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans