Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Hide/show section based on field change in Leads Form.

Posted on by 70

Hi,

I am trying to show the section based on field change but the code is not working. Neither it is giving any error. By default the section is hidden it has to be visible only on one particular value of the field.

Please suggest some resolution.

Thanks.

*This post is locked for comments

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Hide/show section based on field change in Leads Form.

    Did you debug your code to see if, conditions are correct ?? you can use IE developers tools to debug your code.

  • priyanka_24 Profile Picture
    priyanka_24 70 on at
    RE: Hide/show section based on field change in Leads Form.

    Yes, because other part of the code is working only section is not getting visible.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Hide/show section based on field change in Leads Form.

    Hi,

    are you sure that your function is called upon the onChange event?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Hide/show section based on field change in Leads Form.

    var sections = Xrm.Page.ui.tabs.get("tabName").sections.get();

           for (var i in sections) {

               if (sections[i].getName() == "Business Relations") {

                   sections[i].setVisible(true);              

               }

           }

    could you try this once to find section.

  • Suggested answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: Hide/show section based on field change in Leads Form.

    Hi Priyanka,

    Below is the codeto hide section using javascript:

    function HideShowSection(tabName, sectionName, visible) {

       try {

           Xrm.Page.ui.tabs.get(tabName).sections.get(sectionName).setVisible(visible);

       }

       catch (err) { }

    }

    HideShowSection("general", "address", false);   // "false" = invisible

    Hope this helps:)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Hide/show section based on field change in Leads Form.

    Hello,

    could you please write the way you are using.

    I hope you must be using Javascript, best way to find is debugging your java script.

    If you are not able to debug, you could use some alerts.

    otherwise you can paste your query in more detail with code, community would love to help you.

  • priyanka_24 Profile Picture
    priyanka_24 70 on at
    RE: Hide/show section based on field change in Leads Form.

    else if ((StageVal == 'Disbursement') && (SubStageVal == 'Disbursed Fully') && (productgroupId != 'CAG' || productgroupId == 'Vehicle/Auto' || productgroupId == 'SME' || productgroupId == 'Equipment Finance')) {

    Xrm.Page.ui.tabs.get("tab_Disburse").sections.get("tab_disburse_section_1").setVisible(true);

    }

    This is my code. Not working and not giving any erroer.

  • Karsten Wirl Profile Picture
    Karsten Wirl 4,477 on at
    RE: Hide/show section based on field change in Leads Form.

    Hello.

    Please can you show us your code and the error message for more assistance?

    Kind regards,

    Karsten

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans