Dynamics CRM 2011:传递给 FlyoutAnchor JavaScript 函数时 CommandProperties CrmParameter 未正确设置
我正在尝试创建三个动态填充的 FlyoutAnchor 功能区按钮,基于以下答案: 将下拉菜单添加到 CRM 2011 功能区
所有三个 FlyoutAnchor 按钮都使用相同的内容PopulateQueryCommand。链接到命令的 JavaScript 函数(请参阅下面的代码块)获取作为第一个参数传递的 CommandProperties CrmParameter,以便能够识别被单击的弹出按钮(并且应该填充动态添加的下拉列表)菜单项)。
function DynamicMenu(CommandProperties) {
/// <summary>Dynamically generate menu items based on context</summary>
/// <param name="CommandProperties">
/// Command properties crm parameter sent from the ribbon. object used to inject the Menu XML
/// </param>
debugger;
var menuXml = '<Menu Id=\"Sample.DynamicMenu\">' +
// ... Other menu XML stuff goes here
'</Menu>';
CommandProperties.PopulationXML = menuXml; // error here...PopulationXML is undefined... :-(
// ...
}
该函数被很好地调用,并且传递了“CommandProperties”参数(它不是 null
也不是 undefined
),但是当我尝试设置 PopulationXML 时,出现错误,因为该属性未定义
。下面列出的其他三个预期属性也是未定义
:
- SourceControlId:启动事件的功能区控件的 Id 值。
- CommandValueId:单击按钮时与命令事件一起发送的字符串。
- MenuItemId:从控件到菜单项 Id 的引用。
当我传入第二个不同的 CrmParameter(例如 PrimaryEntityTypeName)时,此参数已正确填充/设置。
导致 CommandProperties
参数混乱的原因可能是什么?
2012 年 2 月 21 日更新:为了完整起见,我还尝试了单按钮方法,如 将下拉菜单添加到 CRM 2011 功能区,但这给了我相同的结果(没有可用的命令属性对象)。我的 CRM 服务器正在运行 Rollup 6,也许这与此有关?有没有不同的方法来获取这种弹出功能区菜单?也许是纯 JavaScript 的东西?它也应该在 Outlook CRM 客户端中工作...
I'm trying to create three dynamically filled FlyoutAnchor Ribbon buttons, based on the following SO answer: Add Dropdown Menu to CRM 2011 ribbon
All three FlyoutAnchor buttons use the same PopulateQueryCommand. The JavaScript function which is linked to the command (see code block below) gets the CommandProperties CrmParameter passed as the first argument to be able identify the flyout button which was clicked (and should be filled with dynamically added dropdown menu items).
function DynamicMenu(CommandProperties) {
/// <summary>Dynamically generate menu items based on context</summary>
/// <param name="CommandProperties">
/// Command properties crm parameter sent from the ribbon. object used to inject the Menu XML
/// </param>
debugger;
var menuXml = '<Menu Id=\"Sample.DynamicMenu\">' +
// ... Other menu XML stuff goes here
'</Menu>';
CommandProperties.PopulationXML = menuXml; // error here...PopulationXML is undefined... :-(
// ...
}
The function gets nicely called and the 'CommandProperties' argument is passed (it isn't null
and not undefined
), but when I try to set the PopulationXML I get an error, because this property is undefined
. The other three expected properties listed below are also undefined
:
- SourceControlId: The Id value of the Ribbon control that initiated the event.
- CommandValueId: A string that is sent with the command event when a button is clicked.
- MenuItemId: A reference from a control to the Id of a menu item.
When I pass in a second different CrmParameter, for example PrimaryEntityTypeName, this argument is correctly filled / set.
What could be the cause of the messed-up CommandProperties
argument?
Update 21-2-2012: To be complete, I also tried the single button approach, such as described in Add Dropdown Menu to CRM 2011 ribbon, but that gave me the same result (no usable Commandproperties object). My CRM server is running Rollup 6, maybe that has something to do with it? Is there a different way of getting this kind of flyout ribbon menu's? Maybe something in pure JavaScript? It should also work in the Outlook CRM Client...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了同样的问题,解决方案不是使用
'<菜单 Id=\"Sample.DynamicMenu\">',使用 '<菜单 Id="Sample.DynamicMenu">'
区别在于不使用转义字符“
I was facing the same issue, the resolution is instead of using
'<Menu Id=\"Sample.DynamicMenu\">', use '<Menu Id="Sample.DynamicMenu">'
the difference is of not using escape character for "