zoukankan      html  css  js  c++  java
  • Walkthrough: Capturing the GUID Values of Records Selected in a Grid (CRM 2011 Edition)

    You might remember this one from the SDK for CRM 4.0. Doing the same steps as described here won’t get you there for CRM 2011. It seems the dialogArguments no longer contain the selected Guids.

    It took me a while to figure this out since there was no entry explaining this in the CRM 2011 SDK. Putting it all together got me there finally.

    It all starts of course by adding a new ribbon button to the corresponding grid you would like to get the selected items from. I won’t get into details here on how to do that.
    Once you have the button and command definitions in place, it might look something like this:

    <CommandDefinition Id="NORRIQ.nrq_customentity.Grid.ButtonProcess">
    <EnableRules>
    <EnableRule Id="Mscrm.Enabled" />
    </EnableRules>
    <DisplayRules />
    <Actions>
    <Url Address ="$webresource:nrq_/ProcessCustomEntity.htm" WinMode="1" WinParams="dialogWidth:400px;dialogHeight:200px" >
    <CrmParameter Name="data" Value="SelectedControlSelectedItemIds" />
    </Url></Actions>
     </CommandDefinition>
    

      

    You should especially take a look at the CrmParameter element of the XML. When adding an action of type URL, any parameter you pass should be called data.

    This is not really mentioned in the SDK under the <CrmParameter> (RibbonDiffXml) section. It does state here that you should call it data, as I can expect you would also want to call external URL’s.

    When the CrmParameter is a child of the <Url> (RibbonDiffXml) a Name attribute is required. When the CrmParameter is a child of the <JavaScriptFunction> (RibbonDiffXml) element, the Name attribute is not valid.

    Looking a bit further in the SDK you will end up in the Web Page (HTML) Web Resources section which then states that a Web Page resource can only accept and additional parameter called data. For more info check here.

    After figuring this out I was sure to get the SelectedControlSelectedItemIds parameter passed to my web page in the data parameter.

    You can now break down this data parameter in your web page with a simple JavaScript function like the following:

    function GetSelectedIds() {
    var vals = new Array();
    if (location.search != "") {
    vals
    = decodeURIComponent(location.search).split("=");
    var selectedIds = vals[1].toString().split(',');
    }
    }

      If you were using a JavaScript action the solution would be allot simpler. You could just define your JavaScript function to accept a parameter. This parameter will then be filled by your CrmParameter with the SelectedControlSelectedItemIds. No need to define a name here and you could also add multiple CrmParameters J

  • 相关阅读:
    远程桌面工具mRemoteNG与Tsmmc
    敏感性Sensitivity和特异性Specificity的说明
    React教程:4 个 useState Hook 示例
    React Hooks究竟是什么呢?
    一步一步搭建前端监控系统:如何监控资源加载错误?
    Promise的三兄弟:all(), race()以及allSettled()
    JavaScript中this究竟指向什么?
    编译器与Debug的传奇:Grace Murray Hopper小传
    21个React开发神器
    8种常见数据结构及其Javascript实现
  • 原文地址:https://www.cnblogs.com/Republic/p/2153663.html
Copyright © 2011-2022 走看看