MSCRM4获取选择记录的guid

作者: 傻猫    分类: 搞软件     发布时间: 12-24 14:54    浏览次数: 5491     无留言

一、更改配置文件。

ISV路径:ImportExportXml/IsvConfig/configuration/Entities/Entity name="account"/Grid/MenuBar/Buttons

在配置文件中添加以下XML代码:

<Button 
   Icon="/_imgs/ico_18_debug.gif" 
   Url="/ISV/test.htm" 
   WinMode="2"
>
   <Titles>
      <Title LCID="1033" Text="Get GUIDS" />
   </Titles>
   <ToolTips>
      <ToolTip LCID="1033" Text="Get GUIDS for selected records" />
   </ToolTips>
</Button>

二、编写代码

在isv文件夹下新建 test.html 文件,js代码如下:

<html>
   <head>
      <title>GUIDs for records seleced in Grid</title>
      <script type="text/jscript">
         function listselecteditems()
         {
            var placeholder = document.getElementById("test");
            var sGUIDValues = "";
            var selectedValues;
            //Make sure window.dialogArguments is available.
            if (window.dialogArguments)
            {
               selectedValues = new Array(window.dialogArguments.length -1);
            }
            else
            {
               placeholder.innerText = "window.dialogArguments is not available.";
               return
            }
            selectedValues = window.dialogArguments;
            if (selectedValues != null)
            {
               for (i=0; i < selectedValues.length; i++)
               {
                  sGUIDValues += selectedValues[i] +"\n";
               }
               placeholder.innerText = sGUIDValues;
            }
            else
            {
               placeholder.innerText = "No records were selected.";
            }
         }
      </script>
   </head>
   <body onload="listselecteditems()">
   <div id="test"></div>
   </body>
</html>

事例图片:

 

 

 

添加新评论