Skip to main content

[Order Intake - GCW] How to Setup Lookups

T
Written by Toby Dawson
Updated yesterday

Lookups in GelatoConnect help standardize and translate your internal system data into formats Gelato can understand. This ensures your API orders are processed smoothly by resolving potential mismatches between your identifiers and Gelato's expected values. From mapping product SKUs and shipping methods to carrier codes and regional specifics, lookups are essential for maintaining a robust integration with minimal manual adjustments.


Understanding Lookups in GelatoConnect

Lookups function as translation tables that map custom values from your system to the corresponding standardized values required by Gelato. Without them, orders may fail due to mismatched identifiers.

Typical Lookup Scenarios

  • Product IDs/SKUs: Match your product codes to Gelato’s UIDs.

  • Shipping Methods: Convert internal names to Gelato's shipment codes.

  • Carrier Identifiers: Align naming conventions for logistics providers.

  • Custom Mappings: Handle any value that requires consistent translation.

Key Benefits

  • Ensures consistent and accurate order intake

  • Allows fallback values to prevent errors

  • Supports bulk CSV uploads for large datasets


How to Set Up Lookups

Access the Lookups Section

  1. Log in to your GelatoConnect account.

  2. Navigate to Workflow > Order Intake.

  3. Click Lookups to manage existing mappings or create new ones.

Creating a Lookup Table

Manual Setup

  1. Click Create.

  2. Enter a Name (e.g., "Product SKU Mapping").

  3. Choose the Customer the mapping applies to.

  4. Add an optional Description for context.

  5. Set the Template Field used in templates (e.g., {{sku}}).

  6. Add individual mappings:

    • Key: Your internal value.

    • Value: Corresponding Gelato value.

  7. Click Save Changes.

Bulk Import (Recommended for Large Data Sets)

  1. Prepare a CSV or Excel file with two columns:

    • Lookup key (your internal values)

    • Product UID (Gelato values)

  2. Start a new lookup as above.

  3. Click Import and upload your file.

  4. Review the imported data.

  5. Click Save Changes.

  6. Click Save Changes to apply the configuration.

Using Lookups in Template Mappers

To reference lookup tables in your code, use the lookups() function within your template mapper.

  1. Go to Workflow > Order Intake > Templates

  2. Edit the template where you want to use lookups

  3. In the Template Mapper section, use the lookups() function to access your mapping tables

  4. Basic syntax: {{ lookups({"alias": value_to_lookup}, strict=False, default="fallback_value")|js }}

Note: The key "alias" in the lookups() function should match the Template Field you specified when creating the lookup (e.g., shipping_method, sku). This tells the system which lookup table to use.

For example:

{% set productUid = lookups({"sku": item.sku}, strict=False, default=item.sku) %}

In this case, sku is the alias and must match the Template Field in the lookup named {{sku}}.

Example: Product UID Mapping

{% set productUid = lookups({"sku": item.sku}, strict=False, default=item.sku) %}
"productUid": {{ productUid|js }},

Example: Shipping Method Mapping

"shipmentMethodUid": {{ lookups({"shipping_code": order.shipping.method}, strict=False, default="normal")|js }},

Key Parameters

  • strict=False: Avoids errors if no match is found.

  • default="value": Sets a fallback value.

When Should You Use Lookups vs. Conditionals?

Use lookups when:

  • You need to map more than a few values (e.g., many SKUs, shipping methods, carrier codes).

  • The mappings may change frequently and should be managed outside the template.

  • You want to delegate mapping logic to non-technical users (who can update the CSV).

  • You need a centralized table that can be reused across multiple templates.

Use template conditionals when:

  • You only have 1–2 static values to handle.

  • The mapping logic is simple and unlikely to change.

  • Performance and simplicity are more important than reusability.

Example using a conditional:

{% set shippingMethod = "normal" if order.shipping.method == "cheap" else order.shipping.method %}

Example using a lookup:

{% set shippingMethod = lookups({"shipping_method": order.shipping.method}, strict=False, default="normal") %}

Testing Your Lookups

Before going live:

  1. Open your template via Workflow > Order Intake > Templates.

  2. Go to the Template Testing tab.

  3. Enter test values to validate correct translation.

  4. Confirm fallback values are applied for unmatched keys.

  5. Submit a test order to verify full order processing.

Common Use Cases

Product SKU to Gelato UID Mapping

Map your internal product codes to Gelato's product UIDs:

{% set productUid = lookups({"sku": item.sku}, strict=False, default=item.sku) %}
"productUid": {{ productUid|js }},

Shipping Method Translation

Convert your shipping method names to Gelato's shipment method UIDs:

{% set shipMethod = lookups({"shipping_method": order.shipping_type}, strict=False, default="normal") %} "shipmentMethodUid": {{ shipMethod|js }},

Carrier Mapping

Map carrier identifiers between systems:

{% set carrier = lookups({"carrier_code": shipment.carrier}, strict=False, default=shipment.carrier) %} "carrier": {{ carrier|js }},

Country-Specific State Code Mapping

Handle special cases for state codes in specific countries:

{% set stateCode = shipTo.state %}
{% if shipTo.country|upper == "US" %}
{% set stateCode = lookups({"us_state": shipTo.state}, strict=False, default=shipTo.state) %}
{% endif %}
"state": {{ stateCode|js }},

Troubleshooting Lookup Issues

If lookups aren’t behaving as expected:

  • Double-check for case-sensitive key mismatches.

  • Ensure the Template Field matches the code reference.

  • Always set strict=False and define default values.

  • Review the complete request payload on the Requests page.

Best Practices for Effective Lookups

  • Use clear, descriptive names for each lookup.

  • Include detailed descriptions to explain usage.

  • Keep your mappings up to date with system changes.

  • Use bulk import for efficiency with large data sets.

  • Perform comprehensive testing with valid and invalid keys.

  • Document where each lookup is used in templates.

Want to Learn More?

Now that you've set up lookups for your API integration, you might want to:

  1. Set up postbacks to update your customers


📝 Not what you needed?

Help us improve this article, send us an email to [email protected] — please include the article title.

Did this answer your question?