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)

Dynamics 365 Online Hide Tab Javascript

(0) ShareShare
ReportReport
Posted on by

Hi

I'm new to javascript and I'm trying to add a javascript to my contacts form that hides the tab "Partner Details", i have added the following javascript but get an error on form load:

function HidePartnerTab()

{

var a = Xrm.Page.getAttribute("cf_partnerpropartner").getvalue();

if(a==No)

{

Xrm.Page.ui.tabs.get("Partner Details").setVisible(false);

}

else

{

Xrm.Page.ui.tabs.get("Partner Details").setVisible(true);

}

}

Can anyone tell me where I have went wrong? Any help would be greatly appreciated

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    H5531.7.png"color:#ff0000;">Value();

    https://msdn.microsoft.com/en-us/library/gg334409.aspx#BKMK_getValue

    is the field "cf_partnerpropartner" optionset or two option?

    if yes , please use value instead of name.

    /api/data/v9.1/msdyn_richtextfiles(F7DA0C66-B378-4122-A290-846B8087CBBE)/msdyn_imageblob/$value?size=full

    The tab name should not have space , please check your tab name again.

    /api/data/v9.1/msdyn_richtextfiles(F7DA0C66-B378-4122-A290-846B8087CBBE)/msdyn_imageblob/$value?size=full

  • Community Member Profile Picture
    on at

    Thanks for your help, all good now.

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

    Hi Colin,

    Here is something wrong your code . Please check following comments . Hope this will resolve your issue. Please mark as answer if its resolved.

    function HidePartnerTab()

    {

    var a = Xrm.Page.getAttribute("cf_partnerpropartner").getvalue();

    if(a==No)                                                   ///  You should not write this write  (a == "No") , No should be inside double quotes

    {

    Xrm.Page.ui.tabs.get("Partner Details").setVisible(false);   // Tab Name should not contain space you will get the tabe name from form . double click on Tab.

    }

    else

    {

    Xrm.Page.ui.tabs.get("Partner Details").setVisible(true);

    }

    }

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
Varsha deshpande Profile Picture

Varsha deshpande 5

#2
NeerajPawar Profile Picture

NeerajPawar 2

#2
jlattimer Profile Picture

jlattimer 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans