Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Hide Section or Tab

Posted on by 220

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

  • Suggested answer
    Vipin J Profile Picture
    Vipin J 1,583 on at
    RE: Hide Section or Tab

    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

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Hide Section or Tab

    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.

  • Rasi Profile Picture
    Rasi 220 on at
    RE: Hide Section or Tab

    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
    Nicholas C Profile Picture
    Nicholas C 55 on at
    RE: Hide Section or Tab

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

               }

           });

       }

    }

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Hide Section or Tab

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

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Hide Section or Tab

    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..

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans