This article will describe how to create a workflow that will loop through an Error Profile and automatically retry the workflow errors.
You will have to make use of the K2 Management's GetErrorLogs(Int32 ErrorProfileID, String ProcessFullName) Service Object and create a new SmartObject. Then, create a reference from this new SmartObject and use the reference in the loop. During each iteration of the loop, you will call the RetryError method of the Error Log SmartObject.
1. Create a new SmartObject.
a. In the SmartObject Tester Tool, go to ServiceObject Explorer > K2 Management > K2 Management > Workflow > Management > ManagementService > GetErrorLogs(Int32 ErrorProfileID, String ProcessFullName)
2. Create a new workflow (you can also modify your existing workflow).
a. Add Create Reference step.
iv. In the Input Mappings, type the ID value of the “All” Error Profile.
Alternatively, you can use the ErrorProfile SmartObject's Load method to get the ID from the Name as illustrated below.
v. In the Output Mappings, click ‘Create’ to create a reference.
b. Add Loop step.
c. Add SmartObject step.
3. Deploy the workflow.