HubSpot search filters not populating correctly with One to Many option

Hello,

I have a lookup step that uses a HubSpot connection configured with the One to Many setting to access product ids in a line item array and then use those values in a HubSpot search filter to pull the product data.  However, the value I'm trying to access is always returned empty and the step fails.

Here is the mock data that I'm working with:

{
  "page_of_records": [
    {
      "record": {
        "Line": [
          {
            "Sku": "Sku1",
            "Rate": "14.99",
            "Quantity": 1,
            "Amount": "14.99",
            "Description": "Sku 1"
          },
          {
            "Sku": "Sku2",
            "Rate": "24.99",
            "Quantity": 1,
            "Amount": "24.99",
            "Description": "Sku 2"
          }
        ],
      "Subtotal": "38.98",
        "PO": 1259,
        "Order Id": 4678010896538
      }
    }
  ]
}

Here is the configuration I have for the lookup step.  I have One to Many selected, and I've entered "Line" as the Path to Many.

 

Next, I've configured the filter groups in the body parameters as such:

 

However, when I run this I get the following error:

and if I look in the debug logs I see an empty value for {{Sku}}:

 

To troubleshoot I moved the Sku field to the root of "record" and left everything else as it was:

{
  "page_of_records": [
    {
      "record": {
        "Line": [
          {
            "Sku": "Sku1",
            "Rate": "14.99",
            "Quantity": 1,
            "Amount": "14.99",
            "Description": "Sku 1"
          },
          {
            "Sku": "Sku2",
            "Rate": "24.99",
            "Quantity": 1,
            "Amount": "24.99",
            "Description": "Sku 2"
          }
        ],
      "Subtotal": "38.98",
        "PO": 1259,
      "Order Id": 4678010896538,
      "Sku": "Sku1"
     }
    }
  ]
}

Running this succeeds and I get back a valid response for the lookup.  What this tells me is that either the One to Many/Path to Many is not correct or appropriate here or the handlebar statement I have in my search filter is not correct.  Either way it doesn't appear that Line is being iterated over, instead it's looking at the root of "record".  I've tried to set One to Many to No and rewrite the handlebars as {{Line[*].Sku}} but that fails as well with a parse error, "Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'INVALID'.","

Does anyone have any insight here?  This has been driving me crazy all day.

Thanks!

0

Comments

6 comments
Date Votes
  • Hello Bryan Carroll

    You may be facing a problem because you're trying to reference a nested array in your Path to many. Currently, there is no way to access a nested array using Path to many. You can only access the first-level record. We don't have any documentation on this right now, but we are working to publish this as soon as possible. 

    As for a solution, you can attempt to use a postResponseMapHook script to perform calculations and transformations on the raw data returned by the endpoint. Again, we're working on publishing further articles about this. 

    Thanks!

    0
  • Hi Kathyana Queeman, thank you for the quick reply :)  I thought that the design behind One to Many was when you had a child records that you wanted to use as your datasource and the Path to Many was the field that contained the object array, so in this case it would be "record" : { "Line": [ { "data" ... } ] }, where line is the path to the JSON array (though in this case I guess I don't have child records so much as a I have an array field I need to iterate over).  I guess I'm confused, then, how One to Many/Path to Many is supposed to work.  I do look forward to more documentation/articles regarding this.

    I'll look into the postReponseMapHook to see if it will help us out here.  Ultimately, I need to reference these product skus as discrete values to pass to the HubSpot search API.

    Thanks again for your help!

    0
  • Bryan Carroll could you join us on office hours today? https://zoom.us/meeting/register/338c30f6ce7573eacde7dc3c8da9331e

     

    I just recreated this in my environment and the handlebar is being evaluated.

    0
  • Hi Tyler Lamparter, thanks for the response.  Unfortunately, today will not work for me for office hours.  I did, however, eventually end up recreating the step from scratch in our flow and now it works fine.  I have no idea why it wouldn't work before I recreated it, it's literally configured exactly the same, but we're no longer having problems with this.

    What prompted me to recreate the step is that we have other, similar steps in other flows that are essentially configured the same and work with the same JSON structures and they worked fine so I was scratching my head as to why this particular step wasn't.  Accessing the data works as desired with the One to Many and Path to Many settings I spoke of in my original post.

    0
  • Bryan Carroll sounds good. By chance, did you have any flow branching within the flow that was erroring?

    0
  • Tyler Lamparter No, there wasn't any branching in this flow.

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post