How to retry errors using a Loop step in a workflow

  • 15 February 2022
  • 0 replies
  • 380 views

Userlevel 1
Badge +8

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)

 22779i9B10A3B465A08BF9.png
 
b. Right-click on GetErrorLogs(Int32 ErrorProfileID, String ProcessFullName) and choose ‘Create SmartObject’.
22784iB3A8E8FA903ED5CF.png

 

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

22781i5930533189624FE0.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.                              22791i8466F896EED3B4EA.png

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

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

       22786i69782A7B7852F132.png

 

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

         22790iF5BC713DB335C94E.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.

         22792i79EC145754C262EB.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.

        22796iD0D3C56F8524B37A.png

 

3. Deploy the workflow. 

 

Related Links


0 replies

Be the first to reply!

Reply