How to Map Fields in Bit Flows: A Step-by-Step Guide

Estimated reading: 5 minutes 1415 views

This documentation provides a detailed guide on using Apps and Flow while setting up automation in Bit Flows. Understanding how Apps and Flow interact is essential for creating seamless and efficient workflows.

For this demonstration, we will use Webhook as the trigger and integrate it with Google Sheets as an action. Users will learn how to configure and connect different apps within a flow to automate tasks effortlessly.

Apps

In the App section, you will find all the available mapping fields from previous nodes (including trigger). If you use tools, the extracted data from the tools will also be displayed in the App section.

Map Multiple Values

In Bit Flows, to send trigger data to actions, you need to map the trigger fields to the action fields. You can also map multiple fields to a single field. For instance, if you want to send both name and email values to a single field in Google Sheets, simply select those fields.

Manipulating values

How to use Functions

Functions in Bit Flows help modify and format data while mapping fields. You can use them to transform text, numbers, and other data types to match your workflow needs.

Let’s say we receive a webhook payload containing user purchase details, and we need to extract and format this data before sending it to Google Sheets. In this case, we will use the strLength function to calculate the length of the username.

strLength

The strLength function in Bit Flows is used to determine the number of characters in a given string, including spaces and special characters. This function is helpful when you need to validate input length, apply conditions based on string size, or process text dynamically in your workflows.

Syntax

strLength(text)

Example Usage:

Let’s say we receive a webhook payload containing a user’s name, and we want to check how many characters it contains before saving it to Google Sheets.

info-icon-bit-apps  INFO

Spaces are counted as characters when using the strLength function.

See more available functions here.

How to add System Variables

System variables in Bit Flows are pre-defined variables that provide essential information about the workflow execution, such as flow details, timestamps, execution status, and system environment. These variables help automate processes by dynamically fetching system-related data, making workflow automation more efficient and reliable.

Example: Using Flow Variables in Google Sheets

In this example, we will use Flow ID, Flow Name, and Flow Status as system variables in Bit Flows and send this information to a Google Sheet.

See more available variables here

Identifying an Array

What is an Array in Bit Flows?

An array is a collection of multiple items or values that are stored in a single variable. These items can be of any data type such as numbers, strings, or even other arrays or objects. Arrays are commonly used to handle lists of data, and in Bit Flows, arrays allow you to process multiple values at once within a workflow.

In Bit Flows, arrays can be used in triggers, actions, and field mappings to manage sets of data. You can loop through arrays, extract specific items, or map them to fields in other applications.

Example Webhook Response / Hook Response / Trigger Data

Let’s explore an example where a Webhook is the trigger, and the response contains an array. We’ll break it down step by step to help you understand how to handle arrays in Bit Flows.

Sample Webhook Payload (JSON Response):

{
	"form": {
		"fields": [
			{
				"label": "name",
				"type": "text",
				"value": "Abdur Rouf"
			},
			{
				"label": "OrderId",
				"type": "text",
				"value": "100236"
			},
			{
				"label": "Total",
				"type": "text",
				"value": "$1000"
			}
		]
	}
}

Identifying an Array in Bit Flows While Field Mapping

When you’re working with Field Mapping in Bit Flows, it’s important to recognize when you’re dealing with an array—a collection of multiple values, usually returned in a JSON response. Identifying arrays is essential because arrays require specific handling, such as using an index to access individual items or applying a function to loop through all items.

How to Identify an Array

Look for Square Brackets [] in the Data Structure. Arrays in JSON are represented by square brackets. When you see something like this:

How to Access an Array in Bit Flows

In Bit Flows, when you receive data in the form of an array (such as a list of items in a webhook payload), you need to access specific elements within that array. Arrays are a collection of values, and each value is assigned an index (starting from 0). To access a particular element of an array, you’ll need to specify the index of that element.

How to Access Array Elements in Field Mapping

To access specific values, we use the array index syntax:

fields.[index].value
  1. Accessing the First Item (index 0): To access the first product, use the index [0]. The syntax would look like this:
Field Mapping - Array Index 0

👉Output: Abdur Rouf

  1. Accessing the Second Item (index 1): Similarly, to access the second product, use index [1]:

👉Output: 100236

  1. Accessing the Third Item (index 2): To access the third product, use index [2]:

👉Output: $1000

Since array indexing starts from 0, we can extract the values as follows:

  • Username: fields.[0].value → “Abdur Rouf”
  • Order ID: fields.[1].value → “100236”
  • Total Payment Amount: fields.[2].value → “$1000”

Example Usage in a Message

After mapping these values correctly, we can format a message like this:

👉 Output Message:
Hello, Abdur Rouf. Your order ID: 100236. Total payment amount: $1000.

How to Use Iteration in Bit Flows

When you have an array (e.g., a list of products), you can use the iterator to access each item one by one. The iterator will automatically process each element and perform actions based on the data.

Iteration helps you efficiently handle arrays in Bit Flows. By using the Iterator, you can automate repetitive tasks like processing multiple products or items in a list and ensure that each item is correctly mapped and processed in your workflow.

For more information, see Array Iteration Guide

Share this Doc

How to Map Fields in Bit Flows: A Step-by-Step Guide

Or copy link

CONTENTS

Subscribe

×
Cancel