Skip to main content

WHEN

WHEN is a key/value object used in data sync functions to define a condition. It is used to specify a column and its corresponding value, acting as a filter to retrieve specific rows from a data source.

The key parameter specifies the column name, and the value parameter specifies the value to match in that column.

The returned value is a KVAL object that can be used in conjunction with other data sync functions, such as LOOKUPA, to retrieve specific data from a data source based on the conditions specified with WHEN.

Syntax

KVAL WHEN(object key, object value)
KVAL WHEN(string key, string value)
KVAL WHEN(int key, int value)
KVAL WHEN(int key, string value)
KVAL WHEN(string key, int value)

Example

The example below demonstrates looking up an account name in the account entity of Dynamics, matching the accountid column in the contacts entity to the accountid in the accounts entity.

You can use LOOKUPA when you are connected to the connection, in this case Dynamics 365, on the source:

LOOKUPA("name", FROM("account"), WHEN("accountid",accountid))