Friday, 20 June 2008

Plugin Parameters

Although the CRM 4.0 SDK is generally pretty comprehensive, I find it doesn't contain as much information as I'd like about the information passed to plugins for each of the messages.

The following table lists the main parameters passed to plugins on the most common messages. If the message you want isn't listed here, post a comment and I'll update the table.

MessageParameterDirectionTypeComments
AssignAssigneeInputSecurityPrincipal
AssignTargetInputMoniker
CancelSalesOrderOrderCloseInputDynamicEntity
Close*ActivityCloseInputDynamicEntity
CloseStatusInputInt32
CreateidOutputGuidOnly available on the Post Stage
CreateTargetInputDynamicEntity
DeleteTargetInputMoniker
ExecuteFetchXmlInputString
ExecuteFetchXmlResultOutputString
GrantAccessPrincipalAccessInputPrincipalAccess
GrantAccessTargetInputMoniker
HandleSourceQueueIdInputGuid
HandleTargetInputDynamicEntity
Lose*ActivityCloseInputDynamicEntity
LoseStatusInputInt32
RetrieveBusinessEntityOutputDynamicEntity
RetrieveColumnSetInputColumnSetBase
RetrieveTargetInputMoniker
RetrieveExchangeRateExchangeRateOutputDecimal
RetrieveExchangeRateTransactionCurrencyIdInputGuid
RetrieveMultipleBusinessEntityCollectionOutputBusinessEntityCollection
RetrieveMultipleQueryInputQueryExpression
RetrieveMultipleReturnDynamicEntitiesInputBoolean
RetrievePrincipalAccessAccessRightsOutputAccessRights
RetrievePrincipalAccessPrincipalInputSecurityPrincipal
RetrievePrincipalAccessTargetInputMoniker
RevokeAccessRevokeeInputPrincipalAccess
RevokeAccessTargetInputMoniker
RouteEndpointIdInputGuid
RouteRouteTypeInputRouteType
RouteSourceQueueIdInputGuid
RouteTargetInputMoniker
SendEmailIdInputGuid
SendIssueSendInputBoolean
SendSubjectOutputStringThis is the subject after the tracking token has been added
SendTrackingTokenInputString
SetStateDynamicEntityEntityMonikerInputMoniker
SetStateDynamicEntityStateInputString
SetStateDynamicEntityStatusInputInt32
UpdateTargetInputDynamicEntityTo get the Primary Key, find the KeyProperty within the DynamicEntity
Win*ActivityCloseInputDynamicEntity
WinQuoteCloseInputDynamicEntity
WinStatusInputInt32


Notes:
*ActivityClose. For the Win, Lose and Close messages, one of the parameters is an activity type whose name depends on the primary entity - e.g. the Win message could have a QuoteClose or OpportunityClose entity passed to it

To gather this information I used the plugin tools described on the MSCRM Team blog. The source code for these tools can be found here:
Bulk Registration Tool
Plugin Logger

Other Links:
Plugin Development
Plugin Messages

6 comments:

  1. You may include "handle" message.
    It is used for "Accept" a queue item.

    ReplyDelete
  2. Andrew, thanks for the suggestion. I've added the Handle message, along with the GrantAccess and RevokeAccess messages for sharing entities

    ReplyDelete
  3. http://code.msdn.microsoft.com/crmplugin

    from this site, you can find a file called Enity-Message_Mapping.xls, which probably covers all messages.

    ReplyDelete
  4. Hi,

    my name is Hadi Teo. I have posted a question in the CRM 4.0 Plugin Registration Tool code msdn.

    My question is :

    Using the Plugin Registration Tool 2.1, i can configure the "Execution order" attribute to some integer value. May i know how to configure the "Execution order" in the XML attribute for your plugin, especially in registration.xml ?

    Thanks for your help.

    Hadi Teo.

    ReplyDelete
  5. Hadi

    I've replied to your comment on the MSDN code gallery. Unfortunatley this is not as easy as is should be, due to the classes used in the PlugInDeveloper tool

    ReplyDelete
  6. Hi David,

    Good post. I've benefited much from your expertise for several years, whether on the forums or your blog.

    I'm working with the "book" message for an appointment - the "create" message doesn't seem to do anything for appointment. I'm having a tough time finding the id of the appointment from the input parameters (or output parameters, for that matter) for the book message.

    On a more general note - is there documentation somewhere to help one get a better idea of what's in the input and output parameters? Using the assembly reference for plugins, you have to use the property name to reference it, rather than an index, which seems to make it impossible to get any idea of what properties are available in the input or output parameters.

    Thanks David!

    ReplyDelete