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

  • 相关阅读:
    Transact_SQL小手册
    使用泛型的 TArray 从动态数组中查找指定元素
    使用泛型的 TArray 为动态数组排序
    使用 InputBox、InputQuery 的启发
    近况汇报
    泛型排序器 TComparer
    详测 Generics Collections TList (2): First、Last、IndexOf、LastIndexOf
    详测 Generics Collections TList (1): Add、Clear、Count、Capacity
    WindowsAPI: MulDiv
    SendTextMessage 等方便的消息发送函数
  • 原文地址:https://www.cnblogs.com/Republic/p/2153663.html
Copyright © 2011-2022 走看看