No ratings

How to retry errors using a Loop step in a workflow

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)

 KimberlyL_1-1651061693120.png
 
b. Right-click on GetErrorLogs(Int32 ErrorProfileID, String ProcessFullName) and choose ‘Create SmartObject’.
KimberlyL_5-1651062585060.png

 

c. Give it a name (e.g: GetErrorLogs2) and choose a Category (e.g: Default). Click on the ‘Publish SmartObject’ button.

KimberlyL_3-1651062007302.png

 

2. Create a new workflow (you can also modify your existing workflow).

a. Add Create Reference step.

  1. Select the new SmartObject you created in Step 1.
  2. Choose List method.
  3. Choose ID as Identifier.                              Picture4.png

    iv. In the Input Mappings, type the ID value of the “All” Error Profile.                                                 Picture4.png

Alternatively, you can use the ErrorProfile SmartObject's Load method to get the ID from the Name as illustrated below.

       Picture5.png

 

     v. In the Output Mappings, click ‘Create’ to create a reference.

         Picture6.png

 

b. Add Loop step.

  1.  Select the created reference. It will also create an item reference that you can use in the loop with all the error log information.

         Picture7.png

 

c. Add SmartObject step.

  1. Select the Error Log SmartObject.
  2. Select the RetryError method.
  3. Map the ID, ProcInstID, TypeID, ObjectID from the item reference and specify a UserName.
  4. Link the ‘Next Item’ line to the SmartObject step and link the SmartObject step back to the Loop step.

        Picture8.png

 

3. Deploy the workflow. 

 

Related Links

Labels: (2)
Version history
Last update:
‎04-27-2022 06:48 AM
Updated by:
Contributors