Welcome to Portal
Data mapping is using the variables of a trigger or action as input for the next steps of the flow. It lets you decide how data should be organized when the flow is processing. With mapped data you can create a consistent flow of information through your apps.
Variables are fields provided by the trigger or action as output after an execution. The value of these variables may change with each execution.
For example, every time an event is created in Google Calendar, you want to send a message to a Slack channel to notify your team. You can have a standard message every time: 'A new event has been created'. This does not provide your team with any details of the event and they have to keep switching between Slack and Google Calendar. Instead, you can map variables to the Slack message and provide a helpful text such as 'Content Strategy Meeting at 10 am'.
When configuring a dropdown in an action, you can pick from the available values or use a custom value.
For example, every time a ticket is created, you want to create a task in it. You can't define a particular ticket to create a task in while setting up the flow. If you do so, a new task will be created in the selected ticket every time instead of in the new ticket you want to create the task in.
In cases like these, you can use a custom value. Map the ticket ID from the previous step to this field. When a ticket is created, the ticket ID will be fetched and a task will be created for that ticket.
Note that not all dropdowns can be configured with a custom value. If the other fields in the configuration change depending on the value selected in the dropdown, then you can't use a custom value. For example, consider the Form field in Zoho Forms. The fields in the form in Zoho Forms appear as configuration fields in Zoho Flow. These change with each form, so they won't have the option of using a custom value.
Zoho Flow sends and receives data between apps as payloads. The payload can be sent or received in various formats—the most common being JSON. This format displays data, using , { } and [ ] to separate and group the data together. You can use Test and Debug to view the JSON payload received for the triggers or actions in your flows. JSON defines only two data structures: objects and arrays.
When you see multiple fields appear within one set of { } it is an object. JSON objects are written in key/value pairs. For example:
Here, contact is the object, name and email are the keys, and Frank and frank@zylker.com are their respective values. If you want to map a key to a field, you can use the format:
where:
source - the variable name assigned to your trigger or action from where you receive the payload containing the required information
object - the name of the object
key - the name of the key that holds the value that you need to map to your field
What you see within [ ] is called an array, otherwise called a list. There are simple arrays of strings that contain values that are comma separated. There are also arrays of objects that contain multiple objects with one or more key-value pairs.
For example:
If your trigger or action returns a payload with a variable that is a list or an array, you can use the formula editor to specifically extract a particular array element instead of the whole thing. You just need to know the nature of the array and how the elements are distributed within it. Use the Test and Debug feature in your flow builder to view the JSON payload received for the triggers or actions in your flows.
Arrays are zero-indexed. This means the array elements are numbered starting with 0. [0] is the first element, [1] is the second element, and so on. As a general rule of thumb, to map an element from an array variable, enter the formula in the following format:
where,
source - the variable name assigned to your trigger or action from where you receive the payload containing the required array
array - the name of the array that contains the required value
n - the index of the array element
key - the name of the key that holds the value that you need to map to your field
A common use case of extracting values from an array is when you want to map a field with an entry from line items in Zoho Books trigger response data. For example, if you want to extract the value of Description for the second item under line items, while mapping, modify the formula as:
Suppose you have a flow with the Calendly trigger, Event scheduled by invitee. You might have configured custom questions for which the answers are stored in the array, Questions and answers. If you want to pull the answer of the first question, say Twitter ID from Questions and answers, map the value using the key:
Mapping variables to mandatory fields
When you map variables to mandatory fields, ensure that the variables always return data. If the mandatory fields do not contain data while the flow is processing, the flow will fail.
Modifying the trigger or action after the flow is set up
If you change the trigger or action after the flow is set up, modify the mapped fields accordingly.
Incorrect mapping
Sometimes, a variable with the same name will be provided by multiple steps in the flow. Common examples of this are name or date. Though the variable names are the same, they may provide different values. Make sure that you map the variable from the right step.
Using "$" as a text
Use $$ to include a $ symbol as a part of text. The flow will assume it to be a part of variable if only one $ symbol is used.
E.g: $$${trigger.price} will display the output with a $ symbol.
Subscribe to receive notifications from this article.