Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to hide an entire tab based off of a drop down field selection??

Posted on by 2,645

I am trying to hid an entire tab if a field above is Yes or Blank.  Below is my script, but I keep getting an error that says, "ReferenceError: 'CombineExtractWithExistingExtractOnload' is undefined
   at eval code (eval code:1:1)"

function ProposedClaimsExtractSetupOnLoad()
 {
  var CombineExtractWithExistingExtract = Xrm.Page.getAttribute("nhs_combineextractwexistingextract_y_n_tbd").getSelectedOption();
  if (CombineExtractWithExistingExtract == null || CombineExtractWithExistingExtract =='undefined' || CombineExtractWithExistingExtract =='' || CombineExtractWithExistingExtract =='Yes' )
   {
    Xrm.Page.ui.tabs.get("tab_ProposedClaimsExtractSetup").setVisible(false);
   }
 }  

Any help is appreciated, thank you.

*This post is locked for comments

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    I am also not getting an visible errors that I can see.

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    Sorry, but I an new to jscript and I am not sure on how to get you the answers you are looking for.   For #5, I am calling my script via the event of OnChange for that particular field

  • Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    Hi

    1. Did you debug the code?

    2. Checked the value for CombineExtractWithExistingExtractText?

    3. What is the value of that?

    4. Are you getting any error?

    5. Are you calling this function onload or onchange of that particular field?

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    I put your script in and it didn't seem to work.  Now the tab that I am trying to hide always shows even on load.

  • Verified answer
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    Hi

    Try the following instead of the first function:

    Debug and check.

    function ProposedClaimsExtractSetupOnLoad()  {
          var CombineExtractWithExistingExtract = Xrm.Page.getAttribute("nhs_combineextractwexistingextract_y_n_tbd").getSelectedOption();
          if (CombineExtractWithExistingExtract != null && CombineExtractWithExistingExtract != undefined) {
    
              var CombineExtractWithExistingExtractText = CombineExtractWithExistingExtract.text;
    
              if (CombineExtractWithExistingExtractText == '' || CombineExtractWithExistingExtractText == 'Yes') {
                  hideProposedClaimsExtractSetupTab();
              }
              else if (CombineExtractWithExistingExtractText == 'No' || CombineExtractWithExistingExtractText == 'TBD') {
                  showProposedClaimsExtractSetupTab();
              }
          }
          else
          {
              //show/hide the tab
              hideProposedClaimsExtractSetupTab();
              //showProposedClaimsExtractSetupTab();
          }
     }
  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    Here is my last script update.  As I mentioned, the onload of the form works perfectly.  But it doesn't work for when I select Yes, No, TBD in the drop down field.

    ProposedClaimsExtractSetup Tab to show/hide based on Combine Extract w/ Existing Extract

    ************************************************************************/

    function ProposedClaimsExtractSetupOnLoad()

    {

    var CombineExtractWithExistingExtract = Xrm.Page.getAttribute("nhs_combineextractwexistingextract_y_n_tbd").getSelectedOption();

    if (CombineExtractWithExistingExtract == null || CombineExtractWithExistingExtract =='undefined' || CombineExtractWithExistingExtract =='' || CombineExtractWithExistingExtract =='Yes' )

    {

    hideProposedClaimsExtractSetupTab();

    }

    else if (CombineExtractWithExistingExtract == 'No' || CombineExtractWithExistingExtract =='TBD' )

    {

    showProposedClaimsExtractSetupTab();

    }

    }

    /**********************************************************************

    functions to show/hide based on ProposedClaimsExtractSetupTab

    ************************************************************************/

    function showProposedClaimsExtractSetupTab () {

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

    }

    function hideProposedClaimsExtractSetupTab () {

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

    }

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    So now when I load the form, it is working properly.  However, it doesn't do anything when I change the answer to No or TBD.  My tab should be appearing and it isn't.

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    The the loading of the form is working now, but not when I change the field to yes, or no, or TBD

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    Can you show me what it should look like it?

  • USA80 Profile Picture
    USA80 2,645 on at
    RE: How to hide an entire tab based off of a drop down field selection??

    What do you mean it is missing and from where?

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