Topic
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.
Instructions
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.
- Select the new SmartObject you created in Step 1.
- Choose List method.
- Choose ID as Identifier.
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.
- Select the created reference. It will also create an item reference that you can use in the loop with all the error log information.
c. Add SmartObject step.
- Select the Error Log SmartObject.
- Select the RetryError method.
- Map the ID, ProcInstID, TypeID, ObjectID from the item reference and specify a UserName.
- Link the ‘Next Item’ line to the SmartObject step and link the SmartObject step back to the Loop step.
3. Deploy the workflow.