Can't use {{ value }} in a loop to reference a value in a previous query

I'm trying to make a workflow that needs HubSpot company data. I have the company IDs for HubSpot from our PostgreSQL database, and I'm trying to follow documentation to reference it in a loop. It always says that value is not defined (see screenshot). Am I missing something? It seems simple in the documentation but it just isn't working for me.

Even if I try running it, it runs but it doesn't use the values from the previous query for HubSpot Company IDs.

Have you tried it? It can be a bit buggy with the types in some of these scenarios. I've seen it a few times, but it works, despite it being red.

Yes, I've encountered that a number of times too, but I have run it. This is the error when i run it:

{"data":null,"error":"TypeError: Cannot read properties of null (reading 'entries') (line 2)"}

Try re-running the previous block (the database call) manually by pressing the "Run" button on it, or on your loop select run with previous blocks, that sounds like you don't have any data loaded in your loop. You can double check that by clicking the "Inputs" tab at the bottom of the loop block, and the first chunk of data should show you the loop variables and their values.

1 Like

Thank you, that's actually very helpful. And I believe theoretically should work.

But still got an error :confused: inputs look good to me too (see picture).

That looks like it should be working - which error are you getting? Still the reading entries error, or something different? In a few cases I've switched from the GUI version of the loop to the Code one (toggle "mode" at the top). It gives you access to the underlying code. If you can share the error it might help, otherwise could be worth trying it in code mode to see if it's a bug in the way the GUI is structuring your loop.

Thank you for the help. I tried using Code instead of the GUI (without editing the default code there, similar outcome), but I'm not familiar with Javascript enough to know how to edit it for a workaround. I've passed this on to our engineers to find a better solution for what we were trying to build, so all good now.

Really appreciate your help though (particularly, the validation that it should be ideally working when it wasn't, it was really bothering me). :grin:

How did you guys manage to get this solved? IM getting the exact same error. Ive checked everything, tried a brand new workflow, dumped cache and cookies.. but it keeps telling me Value is not assigned.

Im not sure where to go from here.

I didn't get it to work unfortunately, at least with this method. I found a workaround where it worked using a different Operation. Specifically, the POST batch read and POST batch update (similar to the screenshot below) in the HubSpot Resource. I also used a new API Key on HubSpot. Not sure if that helps. :confused:

1 Like

Unfortunately, I am in the same boat here, only I am trying to use a MySQL Resource.

Doesn't matter what I try.. it says its not defined. It was working fine.. until a few days ago.

Hello @cpearson4772!

Try removing the double {{}} from the query1 code block and returning value.artist name.

I tried replicating the bug and those changes worked for me to get the loop to return the desired value.

@audreyanne96 glad you were able to get your Hubspot integration working! I agree the code you had looked fine, I was going to guess that the issue was either on Hubspots end or from the resources route.