Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

How to find if I am on regular tab or on Related - common

Posted on by 120

In crm 365 uci, I have tabs on the form and Related views list that if I choose one it becomes a tab on my form.
How do I distinguish between passing from regular tab to related tab in JS.

  • Suggested answer
    Amit Katariya007 Profile Picture
    Amit Katariya007 8,530 Super User 2024 Season 1 on at
    RE: How to find if I am on regular tab or on Related - common

    Related tabs are just like related entities to the current record type. You can distinguish between related tab and regular by refreshing the form. If the respective tab is not present then it is a related tab and you will able to see that entity on the related part of the current form. and all those tabs which are present on the form are the main tabs.

    If you want to remove related tab then please follow below article which will help you.

    community.dynamics.com/.../hide-related-tab-from-dynamics-365-form

    Thank you,

    Amit Katariya

  • Suggested answer
    Ray Profile Picture
    Ray 1,505 on at
    RE: How to find if I am on regular tab or on Related - common

    You can check the expand state of normal tabs, if all the state are "collapsed" then related views is opened. Here is a code sample:

    let isNormalTabExpanded = false;
    let tabs = formContext.ui.tabs.getAll();
    for (let index = 0; index < tabs.length; index  ) {
        const tab = tabs[index];
        if(tab.getDisplayState() === "expanded"){
            isNormalTabExpanded = true;
            break;
        }
    }
    console.log(isNormalTabExpanded);

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,490 Super User 2024 Season 2 on at
    RE: How to find if I am on regular tab or on Related - common

    How about hiding the Related Tab and show only required Tabs?
    To hide tabs you can use below link:
    https://carldesouza.com/remove-related-tab-from-dynamics-365-uci-form/

    also, you can use below code to get all tabs.

    function getAllTabs (executionContext) {
            'use strict';
            var formContext = executionContext.getFormContext();
            var tabs = formContext.ui.tabs.get();
    	// all tabs
            for (var i = 0; i < tabs.length; i  ) {
    
    	    if(tabs[i].getLabel() === "")
                {
                       //add your logic here
    
                 //for section only: -get all sections
                var sections = tabs[i].sections.get();
                for (var j = 0; j < sections.length; j  ) {
                    var controls = sections[j].controls.get();
                   //add your logic here
                }
    
              }      
               
            }
        }

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans