Search code examples
pluginsdynamics-crmdynamics-crm-4

Dynamics CRM 4 Delete Plugin not running


I Have a plugin that should run on delete of a custom entity that wont run.

Plugin is registered with Plugin Registrtion Tool setting:

  • Message - Delete
  • Primary Entity - myCustomEntity
  • Secondary Entity - none
  • Filetering Attributes - All Attributes
  • Plugin - the one i want to run
  • Run in user Context - calling user
  • Execurion Order - 1
  • Pre Stage
  • Synchronous
  • Step Deployment - Server
  • Trigeting Pipeline - Parent

with an image called Target registerd as a pre-image.

there are no errors logged on the server and debuging in visual studio with a breakpoint on the first statements in the constructor and execute methods does not result in it entering debug.

any idea what i have done wrong?


Solution

  • Figured it out, i had this line

    if (context.InputParameters.Properties.Contains(ParameterName.EntityMoniker) &&
               context.InputParameters.Properties[ParameterName.EntityMoniker] is Moniker)
    

    which is how it works for MessageName.SetStateDynamicEntity, changed to

    if (context.InputParameters.Properties.Contains(ParameterName.Target) &&
               context.InputParameters.Properties[ParameterName.Target] is Moniker)
    

    and it works now.