Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Dynamics 365 Online Hide Tab Javascript

Posted on by Microsoft Employee

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

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Dynamics 365 Online Hide Tab Javascript

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

    }

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online Hide Tab Javascript

    Thanks for your help, all good now.

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Dynamics 365 Online Hide Tab Javascript

    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

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans