Contact Free trial Login


orElse(TryResult<T>, () -> R): T | R

Returns the result of the orElse if the previous try result failed if not returns the result of the previous

Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later.


Name Description


Previous try result


The next option to try if the previous fails


This example waits shows how to chain different try


%dw 2.0
import * from dw::Runtime
var user = {}
var otherUser = {name: "DW"}
output application/json
    a: try(() ->!) orElse "No User Name",
    b: try(() -> orElse "No User Name"


  "a": "No User Name",
  "b": "DW"

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.