locked
Java script error in outlook RRS feed

  • Question

  • Hi All,

    I have a little JS function to hide a ribbon button as below, it works fine for the purpose. The problem is when I try to access a subgrid ribbon in outlook it errors and all the subgrid's ribbon is disabled. The subgrids appear OK in web browser. Please help.

    JS FUNCTION:

    function HideButton()
    {
        var value = Xrm.Page.getAttribute('new_twoOptionSet').getValue(); // Attribute is a two option set field

        if (value != null && value == true) {
            return false;
        } else {
            return true;
        }
    }

    THE ERROR IN OUTLOOK:

    <CrmScriptErrorReport>
      <ReportVersion>1.0</ReportVersion>
      <ScriptErrorDetails>
       <Message>'Xrm.Page.getAttribute(...)' is null or not an object</Message>
       <Line>718587435</Line>
       <URL>/userdefined/areas.aspx?formid=2d997d0d-4c38-4781-98d3-d25de50fe44e&navItemName=Authorised%20Representative&oId=%7bA3D05DAC-76F8-E211-8E77-00155D21AF36%7d&oType=1&pagemode=iframe&roleOrd=1&security=786487&tabSet=areanew_account_contact_authorised_representative</URL>
       <PageURL>/userdefined/areas.aspx?formid=2d997d0d-4c38-4781-98d3-d25de50fe44e&navItemName=Authorised%20Representative&oId=%7bA3D05DAC-76F8-E211-8E77-00155D21AF36%7d&oType=1&pagemode=iframe&roleOrd=1&security=786487&tabSet=areanew_account_contact_authorised_representative</PageURL>
       <Function>HideButton()</Function>
       <CallStack>
        <Function>HideButton()</Function>
        <Function>anonymous($p0,$p1,$p2,$p3){Mscrm.CrmHeader.setScriptFile(Mscrm.CrmUri.create($p1),true);for(var$v_0=window,$v_1=$p0.split("."),$v_2=0;$v_2<$v_1.length;$v_2++)if($v_0)$v_0=$v_0[$v_1[$v_2]];if(!IsNull($v_0)&&typeof$v_0===Mscrm.TypeNames.functionType){var$v_3=this.$E0_1($p2,$p3);return$v_0.apply(null,$v_3)}returnnull}</Function>
        <Function>anonymous($p0,$p1){var$v_0=this.$Bd_1($p0.FunctionName,$p0.Library,$p0.Parameters,null);if(!IsNull($v_0)&&typeof$v_0===Mscrm.TypeNames.booleanType)return$v_0;elsereturn$p1}</Function>
        <Function>anonymous($p0){if(IsNull($p0))returnfalse;var$v_0=$p0.DefaultValue;switch($p0.RuleType){case8:$v_0=this.$Ec_1($p0);break;case1:$v_0=this.$Ef_1($p0);break;case7:$v_0=this.$Eg_1($p0,$p0.DefaultValue);break;case4:$v_0=this.$Eh_1($p0,$p0.DefaultValue);break;case16:$v_0=this.$Ei_1($p0);break;case2:$v_0=this.$Ej_1($p0);break;case10:$v_0=this.$Ek_1($p0);break;case19:$v_0=this.$El_1($p0,$p0.DefaultValue);break;case17:$v_0=this.$Em_1($p0);break;case12:$v_0=this.$En_1($p0);break;case6:$v_0=this.$Ee_1($p0,$p0.DefaultValue);break;case5:$v_0=this.$Eo_1($p0,$p0.DefaultValue);break;case11:$v_0=this.$Ep_1($p0);break;case3:$v_0=this.$Eq_1($p0,$p0.DefaultValue);break}if(IsNull($v_0))$v_0=IsNull($p0.DefaultValue)?true:$p0.DefaultValue;if(!IsNull($p0.InvertResult)&&$p0.InvertResult)$v_0=!$v_0;return$v_0}</Function>
        <Function>anonymous($p0,$p1){var$v_0=this.getEnableRuleDefinition($p0,$p1);if(IsNull($v_0)||IsNull($v_0.Rules)||!$v_0.Rules.length)returntrue;for(var$v_1=true,$v_2=0;$v_1&&$v_2<$v_0.Rules.length;$v_2++)$v_1=$v_1&&this.$Bc_1($v_0.Rules[$v_2]);return$v_1}</Function>
        <Function>anonymous($p0,$p1){if(IsNull(Mscrm.RibbonCommands.enableRules))returntrue;var$v_0=this.getCommandDefinition($p0,$p1);if(IsNull($v_0))returntrue;var$v_1=$v_0.EnableRules;if(IsNull($v_1))returntrue;for(var$v_2=true,$v_3=0;$v_2&&$v_3<$v_1.length;$v_3++){var$v_4=$v_1[$v_3];if(IsNull($v_4)||!$v_4.length)continue;$v_2=$v_2&&this.$Ed_1($v_4,$p1)}return$v_2}</Function>
        <Function>anonymous($p0){if(!this.$63_1)returnfalse;var$v_0=this.parseCommandFromRibbon($p0),$v_1=this.$Dv_1($v_0.command,$v_0.entityLogicalName);if($v_1&&!IsNull(this.$H_1.$5l_2[$p0]))$v_1=Mscrm.RibbonNavigationModel.shouldContextGroupBeShown($v_0,this.$H_1);elseif($v_1&&!IsNull(this.$H_1.$2E_2[$p0]))$v_1=Mscrm.RibbonNavigationModel.shouldTabBeShown($p0,$v_0,this.$H_1);if(!IsNull(this.$H_1.$2E_2[$p0]))this.$H_1.$2E_2[$p0]=$v_1;return$v_1}</Function>
        <Function>anonymous(command){return!IsNull(this.get_$85()[command])&&this.get_$3P().canHandleCommand(command)}</Function>
       </CallStack>
      </ScriptErrorDetails>
      <ClientInformation>
       <BrowserUserAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; InfoPath.3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Microsoft Outlook 14.0.7012)</BrowserUserAgent>
       <BrowserLanguage>en-us</BrowserLanguage>
       <SystemLanguage>en-gb</SystemLanguage>
       <UserLanguage>en-gb</UserLanguage>
       <ScreenResolution>1364x768</ScreenResolution>
       <ClientName>Outlook Laptop - Online</ClientName>
       <ClientTime>2013-08-02T14:36:36</ClientTime>
      </ClientInformation>
      <ServerInformation>
        <OrgLanguage>1033</OrgLanguage>
        <OrgCulture>2057</OrgCulture>
        <UserLanguage>1033</UserLanguage>
        <UserCulture>2057</UserCulture>
        <OrgID>{492F9A86-0120-E111-98ED-00155D21AF0E}</OrgID>
        <UserID>{04A462F9-845C-E111-A00E-00155D21AF28}</UserID>
        <CRMVersion>5.0.9690.2839</CRMVersion>
      </ServerInformation>
    </CrmScriptErrorReport>

    Monday, August 5, 2013 10:31 AM