0
votes

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?

2

2 Answers

2
votes

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.

0
votes

If you're ever unclear on what parameters you might expect in the InputParameters PropertyBag for a given message, you can look at the SDK for the appropriate MessageNameRequest class and see the Instance Properties for that object (e.g. the DeleteRequest class has just a Target property (of type TargetDelete).