Loading

How to implement Try Scope and For Each without stopping processing

Publiseringsdato: Mar 2, 2024
Trinn

DESCRIPTION

This article is intended to provide one possible design solution that will allow processing to continue when an error is thrown within a For Each Scope. 

The default behavior of the For Each Scope when an error occurs during processing is to stop processing a collection when an error is thrown and then it will trigger the error handler. If you would like processing to continue despite an error being thrown, this KB will provide a possible solution.

More information on For Each Scope error handling can be found in MuleSoft's documentation here: https://docs.mulesoft.com/mule-runtime/4.4/for-each-scope-concept#error-handling

Please note, this solution may be considered a custom implementation and may or may not be supported by MuleSoft Support.

STEPS TO FOLLOW

1.) First, start by adding a For Each Scope to your flow.
2.) Now, within the For Each Scope, add desired processing steps. 
3.) If there is any processing step you would like to check for errors, you can wrap operators in a Try Scope and add an On Error Continue handler to the Try Scope itself.
4.) With this setup, if there is any failure in the specific processing step which is wrapped with a Try Scope, the error will be thrown, but the collection will continue to be processed by the For Each Scope.

An example of what this would look like can be found below:
User-added image

 

Knowledge-artikkelnummer

001115518

 
Laster
Salesforce Help | Article