I need to write a plugin for Dynamics CRM 4.0 that executes when a closed opportunity is reopened in order to change the salesstagecode. My questions are:
- When I register a new step to the plugin, what attribute(s) should I filter on?
- What property on the entity should I check the value of? and
- What should I look for the value of this entity to be so I can determine if the plugin execution should continue?
I've typically written asynchronous workflows and my experience writing plugins is still developing, so I'd appreciate any help and clarification that can be offered.
Please see below the plugin skeleton I've written
public void Execute(IPluginExecutionContext context)
{
if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity)
{
ICrmService service = context.CreateCrmService(false);
DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties["Target"];
if (entity.Name == EntityName.opportunity.ToString())
{
if (entity.Properties.Contains(/*What Property Should I Check Here?*/))
{
//And what value should I be looking for in that property?
}
}
}
}