When planning or building your flows, you can use lookup caches to store data and quickly access it in your flows using Mapper 2.0, Transformation 2.0, lookup cache API endpoints, or handlebar helpers. If you'd like to better understand how lookup caches are used in flows, consider the below examples and then try them in your own flows. This article focuses on configurations for only the lookup or lookup cache, not all flow steps.
This example flow includes a single export and import so that we can move the customer data from Microsoft Dynamics 365 Business Central to Shopify when shipping products globally from the shop.
In this flow, the customer data has country and state fields in the address which are stored differently in the two applications. In Business Central, these details are provided in the short form as two letters, whereas in Shopify these details are provided in the full form. For example, in a customer address, GA, US in Business Central would be Georgia, United States in Shopify. In this scenario to match the data correctly, that is, for the customer details to flow smoothly from Business Central to Shopify, we can create a lookup cache rather than a static lookup or dynamic lookup to store the reference values and map the state and country names quickly and easily.
After you've created your export and import steps, you can map the fields using Mapper 2.0 lookups:
- Click the mapping icon that shows next to your import.
- In the Edit mapping form, in Mapper 2.0, click the Settings (gear) icon next to the "country" field.
- In the Destination data type, select "string".
-
In Field mapping type, select "Lookup".
-
For Lookup type, select Lookup cache.
- In Lookup cache name, select the cache if it's already created. Otherwise, create a new cache.
-
In the Edit Mapping form, for Lookup cache value field, select the column that contains the full name of the country.
Tip
if your lookup cache value is not an object, but a string or number, select
$to retrieve the complete value. - Enter the Source field. For example,
$.address.countryLetterCode. - Click Save and close.
Note
Likewise, based on your requirements, you can use lookup caches to map the fields with Transformation 2.0.
This example includes three steps, that is, an export, a lookup, and an import so that a Slack notification is sent to stakeholders when SKUs fall below a threshold limit.
In this flow, since the inventory items and threshold could change based on market, customer, or business factors, the lookup cache data that stores the threshold should always be accurate, up-to-date, and the same across flows where it is used. In this scenario, to ensure that our lookup cache has the latest info, we can either create the cache and update it manually or create and update the lookup cache data automatically using a flow. (For details, see creating lookup caches in Create & manage lookup caches.)
After you've created the Shopify export step, you can add a lookup step and configure it using lookup cache APIs.
- Click Resources > Export to create an export.
- Select Lookup additional records (per record).
-
In What would you like to export? configure the fields as shown.
- Click Save and close.
Finally, add an import step using a Slack connection. But before that, set up a filter so that only records below a specific limit pass through from the previous step. Then, map the data that has passed through so that a notification about low inventory is sent to your channel to alert stakeholders.
Example 3 – A lookup cache to store and then pull data dynamically using a custom handlebars helper
A lookup cache alias paired with the {{getDataLookupCache}}handlebars helper lets a flow pull configuration data dynamically at run time — and keeps resolving correctly after you clone, snapshot, revert, or promote the integration using integration lifecycle management (ILM).
Say, your integration runs in dev, staging, and production, and each environment uploads to a different SFTP directory. Instead of hardcoding three paths and updating them by hand on every promotion, store them in a lookup cache and look up the right one dynamically.
- Create a lookup cache with an alias — for example, environment-config with alias ID envConfigLC. Aliases stay intact through ILM operations, so nothing breaks when the integration moves to a new environment. For more information, see Register lookup caches & create aliases.
-
Add a record per environment in the lookup cache.
- Reference it in an AFE-enabled field, such as the FTP import's Directory path.
{{getDataLookupCache "envConfigLC" record.environmentName "sftpPath"}}
environmentName is a value that your flow already has (from a script or setting) that evaluates to "dev", "staging", or "production".
When you clone or promote this integration through ILM, envConfigLC keeps pointing to the same cache, so the directory path resolves correctly with no manual remapping.
Note
The getDataLookupCache handlebars helper works in AFE-enabled fields (relative URI, query templates, FTP paths), Salesforce SOQL queries, and NetSuite saved searches — but not in Mapper 1.0, Transformation Rules 1.0, or standalone flows.