Creating the callout to record the create, update, delete, assign and set state actions is not too difficult. First you should familiarize yourself with callout development in Microsoft CRM. It's pretty easy and we have some nice samples to get you started. It's all in our SDK: web or download. Note that callouts are sometime referred to as Business Logic Extensions in the SDK.

I want to use a generic (little 'g' generic not big 'G' generic) callout which all entities will consume.

Here is the code I used in my version of this solution. As you can see it's hardly brain surgery.

  1. Callout gets fired.
  2. Appropriate method is called (eg. PostCreate). This method calls the UpdateCrm method and passes through the 'action' and userContext and entityContext parameters.
  3. UpdateCRM method does the following:
    1. Gets the URL of the CRM server from the registry. There are other ways to do this - but I'm a little obsessed with the registry at moment.
    2. Then create the CRM web service stuff and set the caller id to that of the user who triggered the callout.
    3. Then make a regular web service call to add a new record to the log entity.

The one big gotcha: Do not register this callout for the log entity!

The one little gotcha: Do not register this callout for the Assign Event on Organizational Owned entities (because they can't be assigned)!

Next: In Part 5 we will develop the code to log the Read action.

This posting is provided "AS IS" with no warranties, and confers no rights.

Tags: