Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Show tab based on OptionSet field

Posted on by 795

Hello,

I have a requirement that by default, i set the tab properties to visibility(false) i.e.,hidden . Then,after selecing a value in option set field, i want all the tabs to be visible and i am using this code- :

function customerProfileScoreVisibility()
{
var optionset = Xrm.Page.getAttribute("new_contacttype");
if (optionset != null) {
var text = optionset.getText();
var value = optionset.getValue();
if(text == "Customer")
{
Xrm.Page.ui.tabs.get("SUMMARY_TAB").setVisible(true);
Xrm.Page.ui.tabs.get("SUMMARY_TAB").sections.get("CUSTOMER_DETAILS_TAB").setVisible(true);
Xrm.Page.ui.tabs.get("Transactions").sections.get("tab_4_section_1").setVisible(true);
Xrm.Page.ui.tabs.get("Transactions").setVisible(true);
Xrm.Page.ui.tabs.get("DETAILS_TAB").setVisible(true);
Xrm.Page.ui.tabs.get("Health Behaviours").sections.get("sectioname").setVisible(true);
}
}
}

 But not showing the tabs..Any help?

Thanks and Regards

CRM Beginner

*This post is locked for comments

  • Verified answer
    CRM Beginner  Profile Picture
    CRM Beginner 795 on at
    RE: Show tab based on OptionSet field

    Mam..  Thanks..  It's done..

  • ashlega Profile Picture
    ashlega 34,475 on at
    RE: Show tab based on OptionSet field

    Hi,

     did you try using F12 to debug the script? Add "debugger;" in the first line, then use F12.. then go line by line and see what's happning

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