Showing posts with label Retrieve Message. Show all posts
Showing posts with label Retrieve Message. Show all posts

Tuesday, June 5, 2012

Retrieve Plugin: MS CRM 2011

I was curious in retrieving the information from the context in Retrieve Plugin message. I realized that the context.InputParameters[“Target”], would return null/ throw exception in the retrieve plugin message.
  1.  To overcome that and to access the attribute collection through the context, here are the steps.
Plugin Configuration


2. The changes that needs to go in to the Plugin Retrieve message code. We need to make use of the OutputParameters collection.

            var orderRetrieve = (Entity) context.OutputParameters["BusinessEntity"];
            DateTime? date = null;
            if (orderRetrieve.Attributes.Contains("modifiedon"))
                date = (DateTime)orderRetrieve.Attributes["modifiedon"];



Also, couple of constraints, that I noticed in the Retrieve message plugin,
·         We cannot debug the Retrieve plugin by throwing an exception, in turn, we will not be able to see the tracing messages.
·         We cannot run plugin profiler to debug.

There is a way to handle the above constarints. will be blogging it on those topic soon...