When using the Associate Entity activity, if a relationship already exists between the 2 records the workflow gets stuck in a waiting state with the message.
Cannot insert duplicate key.
Plugin Trace:
[msdyncrmWorkflowTools: msdyncrmWorkflowTools.AssociateEntity]
[msdyncrmWorkflowTools (1.0.33.0): Associate Entity]
Load CRM Service from context --- OK
ParentObjectTypeCode=10177--ParentId=83fb2c89-cedf-e511-80d3-00155dc86ae0
Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: Cannot insert duplicate key.
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
We cannot evaluate if the relationship already exists, so how can we prevent the workflow remaining in this Waiting state. Ideally the activity would cancel if a duplicate key is found and allow any other workflow steps to complete so that the workflow can complete.
Cannot insert duplicate key.
Plugin Trace:
[msdyncrmWorkflowTools: msdyncrmWorkflowTools.AssociateEntity]
[msdyncrmWorkflowTools (1.0.33.0): Associate Entity]
Load CRM Service from context --- OK
ParentObjectTypeCode=10177--ParentId=83fb2c89-cedf-e511-80d3-00155dc86ae0
Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: Cannot insert duplicate key.
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
We cannot evaluate if the relationship already exists, so how can we prevent the workflow remaining in this Waiting state. Ideally the activity would cancel if a duplicate key is found and allow any other workflow steps to complete so that the workflow can complete.