CRM 2011: Global JavaScript and button in status bar

故事扮演 提交于 2020-01-21 05:26:46

问题


I'm not so new in CRM 2011, but I faced with one big problem... I found some solution on net that makes some scoring/ranking system in CRM. I was completely confused when I saw star in top status bar, above ribbon buttons bar, next to username on right corner of screen.

When I click on this button, I open div with some information about users, and scores they have.

  1. Where I can put Java Script function (jQuery for example) that can be executed globally? How to call that function, what event to catch? I need this button/function be active on all pages in CRM like this one.
  2. What is id of that place in top bar? I need it to put this button from my script.

回答1:


The CRM solution you appear to be talking about is this

http://www.wave-access.com/Public_en/ms_crm_gamification_product.aspx

This is obviously unsupported. However they achieve it by adding a dummy button to the ribbon, specifically the Jewel Menu. This button command is linked to a JS function in a webresource. The button is always hidden but the JS file is always loaded.

It should be noted that your JS is loaded into Main.aspx (the root document) From there its a matter of injecting HTML elements or javascript into the desired frame. (Nav or Content)

Here is the RibbonDiffXML to add to a solution.

<RibbonDiffXml>
<CustomActions>
  <CustomAction Id="Dummy.CustomAction" Location="Mscrm.Jewel.Controls1._children" Sequence="41">
    <CommandUIDefinition>
      <Button Id="Dummy" Command="Dummy.Command" Sequence="50" ToolTipTitle="$LocLabels:Dummy.LabelText" LabelText="$LocLabels:Dummy.LabelText" ToolTipDescription="$LocLabels:Dummy.Description" TemplateAlias="isv" />
    </CommandUIDefinition>
  </CustomAction>
</CustomActions>
<Templates>
  <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
  <CommandDefinition Id="Dummy.Command">
    <EnableRules />
    <DisplayRules>
      <DisplayRule Id="Dummy.Command.DisplayRule.PageRule" />
    </DisplayRules>
    <Actions>
      <JavaScriptFunction Library="$webresource:MyGlobal.js" FunctionName="Anything" />
    </Actions>
  </CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
  <TabDisplayRules />
  <DisplayRules>
    <DisplayRule Id="Dummy.Command.DisplayRule.PageRule">
      <PageRule Address="aaaa" />
    </DisplayRule>
  </DisplayRules>
  <EnableRules />
</RuleDefinitions>
<LocLabels>
  <LocLabel Id="Dummy.Description">
    <Titles>
      <Title languagecode="1033" description="Description" />
    </Titles>
  </LocLabel>
  <LocLabel Id="Dummy.LabelText">
    <Titles>
      <Title languagecode="1033" description="Description" />
    </Titles>
  </LocLabel>
</LocLabels>

This goes in the root ImportExportXml element of the customizations.xml You may also need to add Application Ribbons as a solution component via the UI



来源:https://stackoverflow.com/questions/12796821/crm-2011-global-javascript-and-button-in-status-bar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!