Dynamics CRM 2011 – C# Template (Note to self)

Note to self.

Add:

<br />
IPluginExecutionContext context = localContext.PluginExecutionContext;<br />
IOrganizationService service = localContext.OrganizationService;<br />
// The InputParameters collection contains all the data passed in the message request.<br />
if (context.InputParameters.Contains("Target") &amp;&amp;<br />
context.InputParameters["Target"] is Entity)<br />
{<br />
// Obtain the target entity from the input parmameters.<br />
Entity entity = (Entity)context.InputParameters["Target"];</p>
<p>//EntityReference pp = entity.GetAttributeValue("primarycontactid");<br />
//tracingService.Trace(pp.LogicalName);<br />
try<br />
{<br />
//LOGIC GOES HERE<br />
}</p>
<p>catch (FaultException ex)<br />
{<br />
throw new InvalidPluginExecutionException("An error occurred in the plug-in.", ex);<br />
}</p>
<p>}</p>
<p>

After:

if (localContext == null)<br />
{<br />
throw new ArgumentNullException("localContext");<br />
}

 

 

Jason
Jason
I do things in the clloouuudddd