RE: Set next business process stage "active" using a workflow
Your can write your own Custom Workflow Activity to move to the next stage, or use the Workflow Tools by Demian Raschkovan mentioned in the above post.
The update is simple enough. You need to get the Record Id, Stage Id and the Process Id, and call the following function:
private void UpdateStage(IOrganizationService service, EntityReference currentRecord, Guid processId, Guid stageId)
{
Entity current = new Entity(currentRecord.LogicalName);
current.Id = currentRecord.Id;
current["processid"] = processId;
current["stageid"] = stageId;
try
{
service.Update(current);
}
catch (FaultException<OrganizationServiceFault> ex)
{
throw new Exception("WorkflowUtils.ChangeProcessStage.UpdateStage: " + ex.Message);
}
catch (System.Exception ex)
{
throw new Exception("WorkflowUtils.ChangeProcessStage.UpdateStage: " + ex.Message);
}
}
Just make sure that if you have to bypass a stage, you Update the stage, and then update the next stage.
For example if you want to move from Stage 1 to Stage 3, you call the Update function on Stage 2 and then call the Update function on Stage 3.
Hope this helps.