Hi Experts,
I'm getting the following error when I'm trying to cancel a workflow through coded workflow activity.
"The state transition requested is not valid for the current state. Current state: 3, current status: 32, target state: 3."
Please see the code below which i'm using to cancel the workflow.
var processId = (from p in serviceContext.AsyncOperationSet
where
p.PrimaryEntityType.Equals(entityName) &&
p.RegardingObjectId.Id.Equals(entityId) &&
p.Name.Equals(workflowName) &&
(
p.StatusCode.Value == 10 || // Waiting
p.StatusCode.Value == 20 || // In Process
p.StatusCode.Value == 0 // Waiting For Resources
)
select p.Id).FirstOrDefault();
Entity workflow = new Entity("asyncoperation");
workflow.Id = processId;
workflow["statecode"] = new OptionSetValue(3);
workflow["statuscode"] = new OptionSetValue(32);
service.Update(workflow);
thanks
Anil
*This post is locked for comments
I have the same question (0)