Skip to content

bmel:coalesce

Category: Logic & Control Flow · Returns: bmel:any

Signature
bmel:coalesce(values...: bmel:any)

Description

Returns the first non-null / non-empty value from the provided arguments, evaluated left to right.

Variadic function

Accepts a variable number of arguments of the same type.

Arguments

Parameter Type Required Description
values ... bmel:any Two or more values evaluated left to right. Returns the first that is not null or empty.

Examples

First email available
bmel:coalesce({createOrder:Request Payload}.$.customer.email, {createOrder:Request Payload}.$.billing.email, 'unknown')
Client id from a header, else from the payload
bmel:coalesce({invokeAgent:HTTP Headers}.$.X-Client-ID, {invokeAgent:Request Payload}.$.client_id)

← Back to BMEL Reference