Executing Failed Workflow Async Jobs – CRM
In my CRM application we trigger workflows on creation of Orders.
Other day because SQL server was down, there were 600 System Jobs failed with ‘SQL Time Out’ error.
Once SQL server issue fixed we had the problem of fixing failed workflow jobs, Since I cannot re-execute the failed jobs from the CRM ‘System Jobs’ UI, only way is to create 600 Orders again which was tedious.
After exploring I came to know that we can re-execute failed ‘System Jobs’ using ‘ExecuteWorkflowRequest’ SDK message.
ExecuteWorkflowRequest SDK message requires
- WorkflowId
- EntityId
Sample Code –
// Create an ExecuteWorkflow request.
ExecuteWorkflowRequest request = new ExecuteWorkflowRequest(){
WorkflowId = _workflowId,
EntityId = _OrderId
};
// Execute the workflow.
ExecuteWorkflowResponse response = (ExecuteWorkflowResponse)_serviceProxy.Execute(request);
Refer article for source code and execution steps for failed jobs.
🙂