CRM plugin to execute when opportunity is reopened
Posted
by splatto
on Stack Overflow
See other posts from Stack Overflow
or by splatto
Published on 2010-03-25T21:12:57Z
Indexed on
2010/03/26
14:43 UTC
Read the original article
Hit count: 321
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?
}
}
}
}
© Stack Overflow or respective owner