What is mapping?

Modified on Sun, Apr 2, 2023 at 8:00 PM

Within a scenario, components are connected through data element mapping.

In the process of item mapping, information acquired from an initiating module is employed in the configuration of a subsequent (recipient) module.

The mapped data values are subsequently utilized by the module to execute the intended operation.

For instance, the Email Address (originating party's email) and Subject (email subject line) data elements are obtained by the Monitor Email module and subsequently mapped within the configuration of the Dispatch Email module.





What is a data item?

The functionality of a module produces output sets that consist of data items.

A data item generally refers to a particular piece of information collected by a module. It is displayed in the module's output as a label and associated value. To access the module's output, click on the bubble situated above the module.



In the following example of an item, the item's label is "Subject" and the item's value is "Meeting rescheduled".




Mapping a Data Item To map a data item from one module to another, adhere to the following steps:

  1. Access the configuration of the recipient module (the module you want to map items into).
  2. Select the field where you intend to map a data item from a prior module.

This action will open a mapping panel that displays all available data items from previous modules in the sequence. Also, sample values are usually displayed next to the item label.



3. To map an item to a field, click on the item or drag-and-drop the item to the module's input field.

Note:
You can search items using the search field at the top of the mapping panel. The search is performed in both - item labels and item values.


Upon completion, click OK to confirm the module's settings.



The process of mapping data items from a module's output to the input fields of subsequent modules can be repeated for any additional modules incorporated into your scenario. There is no restriction on the quantity of interconnected modules within a scenario.



Note:

For advanced mapping functions please refer to the Using Functions documentation.


Collections and Arrays Output data items in a module that consist of multiple items are referred to as collections (comprising items of varying types) or arrays (containing items of identical types). To facilitate user-friendly mapping, collections are unfolded in the mapping panel, allowing users to map the individual items contained within. Generally, the collection itself is not mapped.

For further information on mapping arrays, refer to the Mapping Arrays segment within this article.

An illustration of a collection in a module's output:



Example of a collection in the module's mapping panel:



Illustration of an array (comprising collections of identical types) within a module's output:



Example of an array (including collections of a uniform type) displayed in the module's mapping panel:




Mapping Arrays

An array represents a unique category of data item. A basic array encompasses one or more text-based values, whereas a complex array consists of one or more collections of identical types. For instance, an email attachment exemplifies a complex array. The Observe Emails module yields an array of attachments for each email, with every attachment comprising a collection that could include elements such as name, content, size, and more.


Mapping an array's first element

If you map the array's recipient name item, will appear in the field like this:

The number between the square brackets is an index that determines which element of the array will be used. Leaving it empty defaults to the first element.


Mapping an array's nth element

If you wish to access another element, enter or map a value between the square brackets. In the below example, enter 2 to select the second element.

Mapping an Array Element with a Specific Key

Certain arrays encompass multiple collections featuring key and value data items. These often comprise assorted metadata, attributes, and so on.

The subsequent example illustrates the output from the WooCommerce > Get a product module, which includes the Meta Data item—an array of collections. Each collection in this array consists of a key item, the Meta Data ID, and a corresponding value item, Value:




The typical requirement is to lookup an element by its given key value and to obtain the corresponding value from the value item. This can be achieved with a formula employing a combination of the map() and get() functions.The following example shows how to obtain the value of the value item of the element with key Meta data ID item value equal to 36675


The result of the formula will be "no".


The detailed breakdown of the formula follows:


1. The 1st parameter of the map() function is the whole array item.


2. The 2nd parameter is the raw name of the value item. To obtain the raw name, hover the mouse cursor over the item in the mapping panel:



Important:
All parameters are case sensitive. Even though in this particular example the item's label differs from its raw name only in capitalization, it is necessary to use the raw name, which is all lowercase value in contrast to the label Value.


3. The 3rd parameter is the raw name of the key item:



4. The 4th parameter is the given key value.


Because the map() function returns an array (as there could be more elements with the given key value), it is necessary to apply the get() function to get its first element:


The 1st parameter of the get() function is the result of the map() function.


The 2nd parameter is the element's index - one.


See also our Extract an item and/or its value from an array of collections video tutorial.


Converting elements to a series of bundles

Arrays can be converted to a series of bundles using the Iterator module:


Important:
The outputs from modules wrapped between an Iterator and Aggregator are not accessible beyond the Aggregator module.


Troubleshooting

Missing items in the mapping panel

For each module, the mapping panel displays all output items listed by the author of the module. In some cases, this list might be incomplete for various reasons and some items might be missing. Nevertheless, Make can auto-discover the missing output items.

All you have to do is to execute the module in the Scenario editor. The exact procedure differs slightly depending on the module's type:

Instant trigger

  1. Right-click the module.

  2. Choose "Run this module only" from the context menu.

  3. If there are no queued webhooks, the module will be waiting for a new webhook to process.

  4. Generate a webhook (e.g. if the module is Slack > Listen for new events, which is watching for new channel messages in a channel, then send a message to the channel).

  5. The module should finish running.

  6. Click the "bubble" above the module to explore its full output.

  7. The mapping panel will now contain all the items that were discovered in the module's output.

Polling trigger

  1. Right-click the module.

  2. Choose "Run this module only" from the context menu.

  3. If there is no output, click on the "Choose where to start" button and adjust the settings. If there is no event to be processed, create one (e.g. if the module is Gmail > Watch emails then send an email to the folder the module is watching) and go back to step 2.

  4. The module should finish running.

  5. Click the "bubble" above the module to explore its full output.

  6. The mapping panel will now contain all the items that were discovered in the module's output.

Other modules

You may choose to execute:

  • The whole scenario (or just the part containing the module). If your scenario starts with a trigger, refer to the Instant/Polling trigger section above.

  • Just the single module.

If you choose to execute just the single module then:

  1. Right-click the module.

  2. Choose "Run this module only" from the context menu.

  3. Provide sample values for the input items and click on the "OK" button.

  4. The module should finish running.

  5. Click the "bubble" above the module to explore its full output.

  6. The mapping panel will now contain all the items that were discovered in the module's output.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article