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 :
Microsoft Dynamics CRM (Archived)

Hiding sections based on lookup field value.

(0) ShareShare
ReportReport
Posted on by

I am attempting to retrieve the value of a CRM 365  lookup field and determine whether to hide a section or not.

I have verified the tab and section names, ran the code successfully through a js validator, but having no luck hiding the field.  What am I missing?  Thanks!

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    function showSocial()

    {

    var curr = Xrm.Page.getAttribute("transactioncurrencyid").getValue()[0].name;

    if (curr != null && curr.getValue() != null)

    {

    if (curr == "euro")

    {

    // Show the sections

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(false);

    }

    else

    {

    // Hide the section

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(true);

    }

    }

     }

  • Suggested answer
    Ivan Ficko Profile Picture
    1,380 on at

    You wrote tab and social pane names wrong. It should be if you are using OOB names:

    Xrm.Page.ui.tabs.get("SUMMARY_TAB").sections.get("SOCIAL_PANE_TAB").setVisible(false);

    You should always use "Name" value, not the "Label" value from the form elements properties.

  • Community Member Profile Picture
    on at

    Thanks for the feedback Ivan, but I am using the correct "Name" values.  Double-checked twice already.

  • Verified answer
    Ivan Ficko Profile Picture
    1,380 on at

    Did you try to debug it in browser console line by line? Than it's obviously bug in first if clause. Second condition is a bit strange to me, you should get an error if you try to execute .getValue() of string type.

  • Suggested answer
    Iswarya Profile Picture
    1,347 on at

    Hi,

    you have to use setvisible true for Show section(your code setVisible(false))

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(true);

    like wise hide section

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(false);

  • Suggested answer
    Hemant Kumar Sahu Profile Picture
    1,829 on at

    Hi Tresia,

    Please debug and check what is the reason behind this.

    Please check you are getting the currency name in lower case.

    try this

    if (curr.toLowerCase()== "euro")

    {

    }

    And please check below as well.

    You need to change the code, instead true u need to use false and vice versa

    // Show the sections

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(true);

    // Hide the section

    Xrm.Page.ui.tabs.get("Summary").sections.get("Social_pane").setVisible(false);

    Thanks

    Hemant

  • Community Member Profile Picture
    on at

    That was it Ivan.  I took that bit out and used the F12 debugger.  Works fine now. Thanks!

  • Community Member Profile Picture
    on at

    Thanks Iswarya I may have those backward through testing different scenarios, but they are correct in the master code.

  • Community Member Profile Picture
    on at

    Thanks Hemant, the mix-up in true/false was just a testing scenario.  It's correct in the master code.  The currency name was pulling correctly once I adjusted the code as Ivan suggested.,

  • whatup Profile Picture
    200 on at

    What was the final solution?

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

#2
Mark Eckert Profile Picture

Mark Eckert 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans