I'm trying to set a default value on the Opportunity Product entity via a Custom Workflow Actvity. That would be so much easier if we could run workflows on that entity...!
Not being a coder, I'm having quite a hard time. Code should be pretty simple and look something like this:
public class LockPricesOpportunityProducts:CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
ITracingService tracingService = context.GetExtension<ITracingService>();
IWorkflowContext workflowContext = context.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = context.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.UserId);
Entity OpportunityProduct = new Entity("opportunityproduct");
OpportunityProduct["ispriceoverridden"] = true;
}
}
I have no error when I compile the code, no error when I register the plugin, and no error when I run the workflow in CRM.
But nothing happens. I'm just trying to set the ispriceoverridden field to True. I thought I would use a Custom Workflow because I can then run it manually and add conditions.
Any hel would be much appreciated.
*This post is locked for comments