Data mapping in Zoho Flow

Data mapping

Introduction

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'.

How to map

  1. When you configure an action, all the available variables will be listed on the right of the configuration window under Insert Variable. You can view variables from all previous steps. They will be classified by the trigger or action they came from.

  2. Click the trigger or action to view all variables it provides.
  3. Click the field in the action that you are configuring. Once your cursor is there, click the variable you want to map.

  4. You can map as many variables as you need.

Note: Make sure that you map the variables to the right fields. The icons to the left of the variable indicate what type of data each variable provides.

Mapping custom values

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.

Understanding data and syntax

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.

Note: Variables and field names must be formed of English characters and numbers. Other languages are not supported.

Objects

When you see multiple fields appear within one set of { } it is an object. JSON objects are written in key/value pairs. For example:

  1. contact: {
  2. "name" : "Frank",
  3. "email" : "frank@zylker.com"
  4. }

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:

  1. ${source.object.key}

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

Lists or Arrays

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:

  1. "cars" : [
  2. {"name" : "BMW" , "model" : "X3"},
  3. {"name" : "Audi" , "model" : "Q5"},
  4. {"name" : "Ford" , "model" : "Mustang"}
  5. ]

Mapping list or array elements

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:

  1. ${source.array[n].key}

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
- 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 few use cases

Zoho Books - Extracting a line item entry

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:

  1. ${trigger.line_items[1].description}


Calendly - Pulling individual responses from Questions and Answers

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:

  1. ${trigger.questions_and_answers[0].answer}

Mapping entire trigger (or action) variables

If you need to pass on all the variables received from the trigger (or an action) of your flow to a custom function or a key-value field, you can use the following format:
${source}
where, source is the variable name assigned to the trigger or the action.
For example, to refer to all the variables collected by your flow's trigger, use ${trigger}.

Note: The variable name assigned to a trigger is 'trigger' by default. Make sure you use the same name in the snippet.
Ensure that the field you are mapping the variables is of datatype Map (Key-value).

Mapping system variables

You can map contextual information like current date and current datetime to a field using system variables.


  1. Current date: The date when the task is executed will be passed on to the field it is mapped to. (Format: yyyy-MM-dd; e.g. 2021-11-29)
  2. Current datetime: The date and time when the task is executed will be passed on to the field it is mapped to. (Format: yyyy-MM-ddThh:mm:ssZ; e.g. 2021-12-19T23:30:30+05:30)

Common problems with mapping

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.


    Zoho DataPrep Personalized Demo

    If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

    Zoho CRM Training

      Create, share, and deliver

      beautiful slides from anywhere.

      Get Started Now





              Zoho CRM Training Programs

              Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

              Zoho CRM Training

                  Zoho SalesIQ Resources



                      Zoho TeamInbox Resources




                                Zoho DataPrep Resources

                                  Zoho DataPrep Demo

                                  Get a personalized demo or POC

                                  REGISTER NOW


                                    Design. Discuss. Deliver.

                                    Create visually engaging stories with Zoho Show.

                                    Get Started Now











                                                          • Related Articles

                                                          • Best practices while using Zoho Flow

                                                            Workflows form a part of business processes and day-to-day activities. An effective business workflow requires a good deal of planning and a set of practices that ensure that they continue to work as intended. Similarly, automated workflows can also ...
                                                          • Test and debug

                                                            Testing and debugging the flow before it works with real data lets you identify and fix any errors. You can make sure that your data is transferred across the apps as intended. Click the Test & debug icon in the top right corner. ​ Your flow fetches ...
                                                          • Troubleshooting - Overview

                                                            Any problem that you are facing will generally come under one of these categories: Problems with flow creation  Problems with flow execution Problems with the Zoho Flow platform - Navigation or settings Organization and user related problems This ...
                                                          • Encryption in Zoho Flow

                                                            Encryption is primarily used to safeguard the contents of a message so that only the intended recipient can read it. This is done by replacing the contents with unrecognizable data, which can be understood only by the intended recipient. This is how ...
                                                          • Webhook trigger

                                                            What is a webhook? A webhook is a user-defined URL callback. It is a mechanism that enables apps to receive data updates in real time through a URL call. Webhooks can be incredibly helpful when you're working with data updates that need to be ...

                                                          Resources

                                                          Videos

                                                          Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                          eBooks

                                                          Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                          Webinars

                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                          CRM Tips

                                                          Make the most of Zoho CRM with these useful tips.



                                                            Zoho Show Resources