Dynamics 365 CRM Plugin Messages

If you are developing a plugin, sooner or later you will need to do something in a plugin that requires “listening” to more than just Create, Read, Update, and Delete messages.

What is a Message?

If you are new to Dynamics CRM development, a Message word that is used to instruct CRM to do something. As far as I can tell, since the early versions of the CRM SDK used the SOAP protocol exclusively, and SOAP passes messages, the term message became the standard name for CRM internal processing options

If anyone has any other explanation, please let me know and I’ll update the post.

What do you do with Messages?

Messages are what a plugin “listens for” to know when to activate and perform whatever job it was programmed to do.

A Message is associated with a Plugin Step ( internally called a SdkMessageProcessingStep ), which is a pointer that associates your plugin code to a Dynamics CRM internal action.

Inside the Plugin Registration Tool, you may see something like this:

image

As you can see, I have an assembly called ClassLibrary1, within that assembly I have a single plugin, SamplePlugin, and that plugin has two steps:

  1. Create of a queue item
  2. Create an email

Create is the Message.

How do I make it GO?

So, how do you, as a plugin developer, figure out what message you need to use to properly configure your plugin?

Well, for the most part, it’s pretty simple: You select the CRM operation you are interested in intercepting then select Entity that will be associated with that Message.

Here is how the configuration looks within the Plugin Registration Tool:

image

But what if I don’t know what message to use?

Excellent question, and the reason for my article.

The very fine folks in the Dynamics CRM documentation team have created for us, an Excel worksheet that lists all of the messages associated with a CRM Entity.

After you install the CRM SDK, you’ll find the worksheet here:

sdk\tools\message-entity support for plug-ins.xlsx

And here is how it looks:

image

It lists the following information:

  • Message Name
  • Primary Entity
  • Secondary Entity
  • Message Availability
  • Server or
  • Both – for Client and Server
  • Entity Supported Deployment
  • Server or
  • Both – for Client and Server

How do I use it?

Usually, I know what Entity I am going to work with so I start there and filter the Primary Entity-based on that information.

Next, I try and locate the Message Name that I might need. Now, this sounds simple, but in certain cases, it’s really hard to determine what exact message you should connect with.

In that case, I will sometimes create steps that monitor each possible message, connect my debugger to IIS, then execute the CRM operation of interest so that I see what message is actually being passed through to my plugin.

You can find the message in the Execution Context’s MessageName property.

Option 2

A second option is to look in the SDK help file itself for topics like:

Email (E-mail) Entity Messages and Methods

Where you will find information like this:

image

This should be the same (mostly) list of Messages found in the Excel file. Just remove the word “Request” from the end of the Message Name found in the SDK help file and you should have a match.

Conclusion

Well, that’s about it for today. Hopefully, this will help you in your plugin development efforts.

Author: Surya Pratap Singh

I am a Dynamics 365 Sales Functional Consultant Associate|MCSE|MCSA|MCP.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s