tips & tricks


Calendario
dicembre 2024
lmmgvsd
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

Recuperare il GUID dalla Griglia con un bottone

Configure ISV.Config

This example will configure a button on the Account entity grid. There are three steps to this process:

  • Export ISV.Config
  • Configure the button for the Account entity grid
  • Import ISV.Config.
  1. In the Microsoft Dynamics CRM Web application, click Settings.
  2. Click Customization and then Export Customizations.
  3. Scroll down the list of Exportable items and select ISV.Config.
  4. Click Export Selected Customizations.
  5. Save the customizations.zip file.
  6. Extract the customizations.xml file from the customizations.zip file.
  7. Open the customizations.xml file using Visual Studio or any text editor, such as notepad.
  8. The default ISV.Config includes a number of sample extension control configurations. You can modify one of the existing extension controls or configure a new one.
  9. Locate the following node in the default ISV.Config:

ImportExportXml/IsvConfig/configuration/Entities/Entity name="account"/Grid/MenuBar/Buttons

  1. Configure a button element as a child of the Buttons element using this XML:

2.  <Button

3.     Icon="/_imgs/ico_18_debug.gif"

4.     Url="/ISV/test.htm"

5.     WinMode="2"

6.  > 

7.     <Titles>

8.        <Title LCID="1033" Text="Get GUIDS" />

9.     </Titles>

10.   <ToolTips>

11.      <ToolTip LCID="1033" Text="Get GUIDS for selected records" />

   </ToolTips>

</Button>

The key elements are the Url and WinMode attributes to the Button element. The URL must point to a page on the same domain as the Microsoft Dynamics CRM Server. This example will place the test.htm page in the ISV directory located in the Microsoft Dynamics CRM web site installation path. The WinMode attribute must be set to either 1 or 2 so that a dialog window is opened rather than a standard window. Window.dialogarguments is only available for the two dialog windows (modal and modeless).

  1. Save customization.xml file with the changes you have made.
  2. In the Microsoft Dynamics CRM Web application, click Settings.
  3. Click Customization and then Import Customizations.
  4. Browse to the customization.xml file you have saved and click Upload.
  5. After the file has loaded, click Import Selected Customizations.

Create the HTML Page to Capture the GUIDs

This page will use a JScript function in the onload event of the page to detect whether the window.dialogarguments is available and simply display the GUID values in the page. In a solution that would take actions using the GUID values, these values would typically be passed to another application.

  1. Create a file named test.htm in the ISV folder of your Microsoft Dynamics CRM Web application.
  2. Use the following code in the page:

3.  <html>

4.     <head>

5.        <title>GUIDs for records seleced in Grid</title>

6.        <script type="text/jscript">

7.           function listselecteditems()

8.           {

9.              var placeholder = document.getElementById("test");

10.            var sGUIDValues = "";

11.            var selectedValues;

12.            //Make sure window.dialogArguments is available.

13.            if (window.dialogArguments)

14.            {

15.               selectedValues = new Array(window.dialogArguments.length -1);

16.            }

17.            else

18.            {

19.               placeholder.innerText = "window.dialogArguments is not available.";

20.               return

21.            }

22.            selectedValues = window.dialogArguments;

23.            if (selectedValues != null)

24.            {

25.               for (i=0; i < selectedValues.length; i++)

26.               {

27.                  sGUIDValues += selectedValues[i] +"\n";

28.               }

29.               placeholder.innerText = sGUIDValues;

30.            }

31.            else

32.            {

33.               placeholder.innerText = "No records were selected.";

34.            }

35.         }

36.      </script>

37.   </head>

38.   <body onload="listselecteditems()">

39.   <div id="test"></div>

40.   </body>

</html>

The listselecteditems function is called when the page loads. If window.dialogArguments doesn't exist, the innerText property of a placeholder div element in the pages is updated with a message. If window.dialogArguments does exist, a new array is created based on the length of window.dialogArguments. Then a for loop interates through the items in the array and the GUID values are appended to a string. The innerText value of the placeholder div element is updated with the string value.

Save the test.htm page to the ISV folder.

Test the Button

  1. In the Microsoft Dynamics CRM Web application, click Workplace.
  2. Click Accounts.

You should see the button you configured in the toolbar.

  1. Select a number of accounts in the view and then click the Get Guids button. The test.htm page should open and display the GUIDs for the selected accounts.


 

Categoria: CRM 4.0
martedì, 29 apr 2008 Ore. 13.47
Archivio Posts
Anno 2020

Anno 2018

Anno 2015

Anno 2013

Anno 2011

Anno 2010

Anno 2009

Anno 2008
Statistiche
  • Views Home Page: 15.071
  • Views Posts: 58.212
  • Views Gallerie: 2.837
  • n° Posts: 117
  • n° Commenti: 1
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003