Export (0) Print
Expand All

Finding the ID from ASP.NET Code

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

If the program is an ASP.NET Web application or ASP.NET Web service that will be accessed from Microsoft Dynamics CRM, the simplest way to obtain the entity instance ID and entity type of the record being viewed in Microsoft Dynamics CRM is to modify the isv.config file and add an element that is either a Button or a MenuItem. Both elements have an attribute called PassParams. When you set this attribute to a value of "1", the Microsoft Dynamics CRM application is configured to pass the entity instance ID and entity name of the record as query string variables to the custom ASP.NET-connected application. The code in your custom Web application or Web service can access this information by referring to the HttpRequest.QueryString collection in the Request class as shown in the following example. For more information about how to add a custom button or menu item, see Client Extensions.

Example

The following code example shows you how to access the entity instance ID and entity type code.

[Visual Basic .NET]
Dim objID As String = Request.QueryString("id")
Dim objEntityName As String = Request.QueryString("typename")
[C#]
string objID = Request.QueryString["id"];
string objEntityName = Request.QueryString["typename"];

The IDs of selected items on the Microsoft Dynamics CRM grids can also be passed into an opened dialog form as an array. If the page is on the same domain as the Microsoft Dynamics CRM server, you can access this array using Jscript and the dialogArguments property in the window object.

See Also

Concepts


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft