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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Hide Section or Tab

(0) ShareShare
ReportReport
Posted on by 222

Hi Guys,

Is there such a business rule where I could hide Section(s) or Tab(s) depending on fields value.

Thanks

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi Rasi,

    You cannot create business rule to show or hide sections / tabs.. but you can write JavaScript to show / hide sections and tab from form.

    TO show /hide tabs

    formContext.ui.tabs.get("tabname").setVisible(true); //to show

    formContext.ui.tabs.get("tabname").setVisible(false); //to hide

    more details

    docs.microsoft.com/.../formcontext-ui-tabs

    and for sections

    var tabObj = formContext.ui.tabs.get("tabname");

    var sectionObj = tabObj.sections.get("sectionname");

    sectionObj.setVisible(true); //to show

    sectionObj.setVisible(false); //to hide

    more details

    docs.microsoft.com/.../formcontext-ui-sections

    Hope this will help..

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Unfortunately you can not hide section  tab using business rules. You need to write JavaScript for that as suggested above.

  • Suggested answer
    Nicholas C Profile Picture
    55 on at

    Rasi, no there is not a business rule for this in CRM that i am aware of.

    You could apply JS logic to hide a particular section in CRM easily depending on your fields value on the CRM form. Here is essentially a function that you can use in CRM. You can pass the sectionname, and then the visibility choice in order to show or hide your desired section.

    function ViewFormSection(sectionname, visibility) {

       var tabs = Xrm.Page.ui.tabs.get();

       for (var i in tabs) {

           var tab = tabs[i];

           tab.sections.forEach(function (section, index) {

               if (section.getName() == sectionname) {

                   section.setVisible(visibility);

               }

           });

       }

    }

  • Rasi Profile Picture
    222 on at

    Thanks for you reply, Where would I put the field Value? I have many sections/tabs but I only want to display if field option set = required option.

  • Suggested answer
    Mahadeo Matre Profile Picture
    17,021 on at

    you need to add this code on form load and field option set change.

    Create JavaScript function with parameter as option set value, and add logic to show / hide based on option set.

    call this function on form load and pass option set value.

    also call this function on option set value change so that tab/ section will be shown / hidden.

  • Suggested answer
    Vipin J Profile Picture
    1,603 on at

    I have created some Generic Method to Hide and Show Tab and Section

    Please refer here : https://vjcity.blogspot.com/2021/07/generic-method-to-hide-and-show-tab-and.html

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans