Identifying when a Dynamics Plugin Fires

I recently had a problem where we had multiple events tied to a single plugin (not the perfect architecture, but one I had to work with) on the disassociation of a record from a Many-2-Many grid.

pluginevents.png

The problem with the above implementation is that for each Disassociation even we were registered for both the Pre and Post events (whereas one plugin required both, but another only required the Post event).

To detect which even the plugin was handling I was able to key off the following Input Parameter to what event was firing.

localContext.PluginExecutionContext.InputParameters.Contains("parentExecutionId")

If the “parentExecutionId” variable existed, I was in the Pre-Step and if it did not I was in the Post-Step.

Post A Reply

%d bloggers like this: