This documentation is archived and is not being maintained.

CrmService Execute Method

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

In addition to the common methods, you can use another method to execute business logic and other special operations. This method, called the Execute method, uses a message-based approach, and supports a message class hierarchy to group similar operations. This method takes a message request class as a parameter and returns a message response class. Request message class names end with the keyword "Request". Response message class names end with the keyword "Response". For a list of all messages supported by the Execute method, see CrmService Messages.

Execute method

Message Request and Response Classes

The Execute method has a request parameter and returns a response as shown below:

public Response Execute(
  Request  Request
[Visual Basic .NET]
Public Function Execute(
  ByVal Request As Request
) As Response

For each supported message, there are corresponding subclasses for the Request and Response classes. The following diagram shows a portion of the hierarchy of request and response classes.

Request and Response class hierarchy

There are two types of request classes: generic and entity specific.

Note   You must set all fields in the request class. Leaving fields blank or null may have unexpected results.

In This Section

Generic Request Classes

Describes the messages that apply to many entities or no entity.

Entity Specific Request Classes

Describes the messages that are specific to an entity type.

Request Classes that can Return the Dynamic Entity Class

Describes the messages that can return either a strongly typed entity or the dynamic entity class.

Message Target Classes

Describes the message target classes.

Using Optional Parameters in Messages

Describes which messages can use optional parameters.

© 2010 Microsoft Corporation. All rights reserved.