If need to use data from a field but it may not always exist, you can set a default value using Make’s ifempty().

For example, let’s say you have an optional country field in an event registration form. If someone registering for the event doesn’t fill in that field, you want to default it to the United Kingdom.

In the module where you are taking the action, you can use ifempty() to set the default if the value doesn’t exist.

{{ifempty(11.data.country; "United Kingdom")}}

Let’s break down what this is doing.

The first parameter is the country field from the trigger, or a previous step.

The second parameter is the value you want to use if the first paramater is empty. This can either be a string, as it is here, or data from another field.

This is what it would look like if you are using the value from another field.

{{ifempty(11.data.country; 1.details.items[].registrationForm.country)}}

The first and second paramaters are separated by a semi colon (;).

Make’s ifempty is a quick and easy way to set default values for situations where you aren’t sure if the data will be available every time a scenario runs.

For more information on ifempty, check out Make’s official documantation. General functions

Similar Posts