How to Filter or Branch on Nested Array Fields in Input Filters, Output Filters, and Branching

Sometimes, you may need to filter or create branches in your flow based on a field that is nested within an array. Unfortunately, fields like these often don't appear in the dropdown menu, and entering them as an expression directly in the UI won't work either. For example, if you're looking for a field like order_lines.0.sku, it will not be available in the dropdown or directly usable in expressions within input filters, output filters, or branching rules.

The backend fully supports referencing nested fields, but the UI doesn't currently allow typing in fields that aren't in the dropdown. To work around this:

  1. Use the ZangaBox Chrome Extension:
    This tool allows you to directly edit and update the flow JSON without needing to use Postman or manually call APIs.
  2. Steps to Edit Your Flow:
    • Open the ZangaBox extension while viewing your flow, export, or import.
    • Locate the filter, output filter, or branching rules you want to update.
    • Update the relevant field to include the nested array path (e.g., order_lines.0.sku).
    • Save the changes by clicking PUT.

We’re actively working on reimagining the branching and filter UI (hopefully this year) to address this issue. Future updates will also include support for Handlebars expressions in these scenarios.

0

Comments

2 comments
Date Votes
  • Alternatively, you could extract the field you later want to filter on. You would either do this on a transformation on your export or within response/result mapping after an import or lookup. The only caveat is this alternative method would not work when using one-to-many on an import or lookup step. If that is you're case, then the original method in this post would work or you would need a postResponseMap script on your import/lookup that has one-to-many set and the results/response from it has the field you want to later filter on.

     

    Export transform:

     

    Lookup result mapping:

     

    Import response mapping:

     

    0
  • Example postResponseMap script for the one-to-many use cases:

    function postResponseMap(options) {
      options.postResponseMapData.forEach(record => {
        if (record.applications && record.applications.length > 0) {
          const applicationDetails = record.applications[0].applicationdetails;
          if (applicationDetails && applicationDetails.properties) {
            record.tier = applicationDetails.properties.tier;
            record.company_type = applicationDetails.properties.company_type;
          }
        }
      });
      return options.postResponseMapData;
    }
    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post