2
votes

I have a set of buttons on one of my custom entities ribbon and also one on account entity ribbon. When i click one of them, i'm seeing page error message on the status bar but all of them are running their functionalities correctly. When i debugged code with IE Developer Tools, i realized that it was releasing page error before my code's run. Does anyone have any idea about this situation?

Thanks in advance,

Ozer

Xml Code :

<RibbonDiffXml>
  <CustomActions>
    <CustomAction Id="NXM.account.Form.SearchMerchantInDB.CustomAction" Location="Mscrm.Form.account.MainTab.Workflow.Controls._children" Sequence="1">
      <CommandUIDefinition>
        <Button Id="NXM.account.Form.SearchMerchantInDB.Button" Command="NXM.account.Form.SearchMerchantInDB.Command" LabelText="Üye Firma / İş Yeri Sorgula" ToolTipTitle="Üye Firma / İş Yeri Sorgusu" ToolTipDescription="Firma / iş yerinin Üye Firma / İş Yeri olup olmadığı bilgisini sorgular" TemplateAlias="o1" Image16by16="$webresource:new_searchmagnifier16x16" Image32by32="$webresource:new_searchmagnifier32x32" />
      </CommandUIDefinition>
    </CustomAction>
  </CustomActions>
  <Templates>
    <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
  </Templates>
  <CommandDefinitions>
    <CommandDefinition Id="NXM.account.Form.SearchMerchantInDB.Command">
      <EnableRules></EnableRules>
      <DisplayRules></DisplayRules>
      <Actions>
        <JavaScriptFunction Library="$webresources:new_account" FunctionName="CheckIfMember" />
      </Actions>
    </CommandDefinition>
  </CommandDefinitions>
  <RuleDefinitions>
    <TabDisplayRules />
    <DisplayRules />
    <EnableRules />
  </RuleDefinitions>
  <LocLabels />
</RibbonDiffXml>
4

4 Answers

1
votes

After a hard work I found the mistake. If you set your Library attribute as

"$webresources:new_account"

when it should be

"$webresource:new_account"

you will experience this error. I mean your code will run, when you put a "debugger" word to your function debug tools will catch but your page will give page error.

@Philip, @Grigory thank you guys for your efforts and answers.

0
votes

Try to run debugger on the page then press "Ctrl + R" for refresh and then click your buttons. Debugger should stop on the line where the error occurs.

0
votes

It sounds like the page may have raised an exception before your button click event (perhaps OnLoad) do you have any custom code which runs on this form onLoad? If so I would look at what that code is doing first to rule that out. Failing that if no other code is running (which can be confirmed by disabling all events on the form) does the page still error? If so then validate that the fields on the form have all attributes correctly defined, such as display name etc as sometimes this can cause a form to error.

0
votes

For posterity, I had the same problem but my solution was slightly different. I referred to my custom Web Resource library as:

/WebResources/xxx_js_mylibary.js

when you can't have the .js part.

Instead,

/WebResources/xxx_js_mylibary

Hope that helps someone down the line. Thanks to the preceding participants in this conversation for steering me in the right direction.