Fallback transform function
Introduction
The fallback transform function is used to provide a value to be used if a source field to be mapped is empty. For example, consider the following payload:
[
{"ref1": "10001","ref2":"10001"},
{"ref1":"20001", "ref2":"20001"},
{"ref1": "10001", "ref2":"10001"},
{"ref1": "30001", "ref2":"30001"},
{"ref1": "10001", "ref2":"10001"},
{"ref1": "", "ref2":"40001"}
]Now, suppose that you are syncing the ref1 field to a target system that cannot accept empty values. Given that the final item in this payload is empty, a process flow would fail.
One way to prevent this is to provide a fallback value - for example, 00000. In this case, our incoming payload would be output as follows:
[
{"ref1": "10001","ref2":"10001"},
{"ref1":"20001", "ref2":"20001"},
{"ref1": "10001", "ref2":"10001"},
{"ref1": "30001", "ref2":"30001"},
{"ref1": "10001", "ref2":"10001"},
{"ref1": "00000", "ref2":"40001"}
]Using the fallback transform function, you can define fallback values using:
Adding a fallback transform
Edit map shape settings
In your process flow, access settings for your map shape. For example:

Access transforms for the required mapping
Locate the mapping rule that you want to update (or add a new mapping rule), then click the transform button. For example:

Add a new transform
Click the add transform button. For example:

Select the fallback transform function
Click in the name field to access a list of all available transform functions, then select fallback from the other category. For example:

Enter your required fallback value
In the fallback field, enter the value to be used if the mapped source field is empty. You can enter a static value - for example:

Alternatively, you can pass in the value of a flow variable, using flow variable syntax - for example:

You can also fall back to the value of another payload field however, this works slightly differently and you don't enter anything here. For details, please see Using another payload field as a fallback value.
Confirm the source field to be transformed
Click the add field button:

...then click in source fields and select the source field to be used for this transform:

Confirm transform settings
Accept your changes (twice), then save the transform.
Using another payload field for fallback values
Consider the following payload:
{"ref1": "", "ref2":"40001","ref3":"40001"}Suppose we need to map ref1 to a target field named reference. There's no value for ref1 but we do have a value for ref2, which could be used as fallback. Now consider another payload for the same scenario:
{"ref1": "", "ref2":"","ref3":"40001"}There's no value for ref1 or ref2 - but we do have a value for ref3, which could be used as fallback.
You can specify one or more fields from the incoming payload(s) to be checked for a fallback value. To do this, follow the steps below.
Edit map shape settings
In your process flow, access settings for your map shape. For example:

Define a mapping rule using all possible source fields
Add a mapping rule in the usual way, with the required source and target fields. For example:

Then click anywhere in the source field:

...and choose to add another source field - for example:

Click anywhere in the new source field:

...and enter or select a field that can be checked for a fallback value - for example:

Accept the new field to exit back to the mapping rule - now you have two source fields mapped to the target:

If required, you can add additional 'fallback' source fields in the same way.
Access transforms for the mapping rule
Click the transform button for this mapping rule. For example:

Add a new transform
Click the add transform button. For example:

Select the fallback transform function
Click in the name field to access a list of all available transform functions, then select fallback from the other category. For example:

Add the primary source field to be used
Click the add field button:

...then click in source fields and select the source field to be used for this transform as a priority - for example:

Select the source field that should be checked for a value first, and accept this change. The field is added as the first to be transformed - you can now add the remaining source fields in the sequence you want them to be checked for a fallback value:

Confirm transform settings
Having added all source fields for this mapping rule, accept your changes - for example:

Last updated
Was this helpful?