locked
MS CRM 2011 Hide/Show tab RRS feed

  • Question

  • Time to ask the experts! I am no stranger to hiding tabs in MS CRM 2011. I have done so many times. Right now, I am working on a javascript that hides or shows fields and tabs based on a condition.

    The fields hide just fine, but I cannot for the life of me get the tabs to hide. I didn't name the tabs and I feel that may be the problem.

    Example: Xrm.Page.ui.tabs.get("{13b0fbf2-e596-4dc5-919b-7a0aea72598b}").setVisible(false);

    I also get the following error log when trying to close the window:

    Microsoft Dynamics CRM Error Report Contents

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
       <Message>Uncaught TypeError: Cannot read property 'setVisible' of null</Message>
       <Line>20</Line>
       <URL>/%7B635393221880003731%7D/WebResources/new_PartnerTypeChange</URL>
       <PageURL>/userdefined/edit.aspx?_gridType=1&etc=1&id=%7b7C889010-1160-E211-8301-002219A2D157%7d&pagemode=iframe&preloadcache=1403725394399&rskey=873492972</PageURL>
       <Function>anonymousr:Cannotreadproperty'setVisible'ofnull</Function>
       <CallStack>
        <Function>anonymousr:Cannotreadproperty'setVisible'ofnull</Function>
       </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
       <BrowserUserAgent>Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36</BrowserUserAgent>
       <BrowserLanguage>undefined</BrowserLanguage>
       <SystemLanguage>undefined</SystemLanguage>
       <UserLanguage>undefined</UserLanguage>
       <ScreenResolution>1920x1080</ScreenResolution>
       <ClientName>Web</ClientName>
       <ClientTime>2014-06-25T12:43:21</ClientTime>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>{79CB36B4-45E9-DC11-BEE6-0015C5FDF8BF}</OrgID>
        <UserID>{E93B2F21-B30A-E311-846E-002219A31D95}</UserID>
        <CRMVersion>5.0.9690.3911</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
       <Message>Uncaught TypeError: Cannot read property 'setVisible' of null</Message>
       <Line>20</Line>
       <URL>/%7B635393221880003731%7D/WebResources/new_PartnerTypeChange</URL>
       <PageURL>/userdefined/edit.aspx?_gridType=1&etc=1&id=%7b7C889010-1160-E211-8301-002219A2D157%7d&pagemode=iframe&preloadcache=1403725394399&rskey=873492972</PageURL>
       <Function>anonymousr:Cannotreadproperty'setVisible'ofnull</Function>
       <CallStack>
        <Function>anonymousr:Cannotreadproperty'setVisible'ofnull</Function>
       </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
       <BrowserUserAgent>Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36</BrowserUserAgent>
       <BrowserLanguage>undefined</BrowserLanguage>
       <SystemLanguage>undefined</SystemLanguage>
       <UserLanguage>undefined</UserLanguage>
       <ScreenResolution>1920x1080</ScreenResolution>
       <ClientName>Web</ClientName>
       <ClientTime>2014-06-25T12:43:34</ClientTime>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>1033</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>1033</UserCulture>
        <OrgID>{79CB36B4-45E9-DC11-BEE6-0015C5FDF8BF}</OrgID>
        <UserID>{E93B2F21-B30A-E311-846E-002219A31D95}</UserID>
        <CRMVersion>5.0.9690.3911</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    Wednesday, June 25, 2014 7:50 PM

All replies

  • Hi,

    Create a new tab and try to hide this new tab based on your condition,

    but do not delete the old tab till your new tab run proper.


    Thursday, June 26, 2014 5:54 AM
  • you can rename the tab to use a more readable string instead of a guid.
    You can also access the tabs by index, for example:

    Xrm.Page.ui.tabs.get(0).setVisible(false);

    to access the first tab on the form (or 1 to access the second and go on).


    My blog: www.crmanswers.net - Rockstar 365 Profile

    Thursday, June 26, 2014 6:39 AM