Skip to main content

TL;DR — While inside a Loops by Zapier loop, Zapier seems to not register changes to a Notion database item that occurred previously in the loop. Adding a delay doesn’t fix.

I am building a Notion app for music collaboration. II am building a Zap to take a search query provided by the user (entered into the Name field of a new database item), search Spotify with the query, and fill out Spotify-provided details of the top result: title, artist, track URL.

My Zap.

The Zap is triggered when the below database item is updated — this part works fine:

Zaps database item that triggers my Zap.

The Zap then searches my Tunes database in Notion for any Tune whose URL field exactly matches “<not synced>”, takes the top result, searches Spotify with the content of the Name field, and updates the Tune — this also works fine on the first loop iteration:

Tunes database item before my Zap runs.
Tunes database item after my Zap runs.

The idea is that, once the URL field is changed from <not synced> to a Spotify URL, the Find Database Item step in my Zap should find a different record. But as the Zap history shows, for some reason it’s just finding the first Tune over and over. I take this to mean that this task is not seeing the updated URL field:

Zap run history on the second loop — in Notion, the Track URL for this record was actually a Spotify link at this point.

To make sure the Zap loop wasn’t running too quickly for Notion to update itself, I added a delay of 1 minute (which is the minimum delay length), but even after waiting a minute, the Zap still thinks the URL field is “<not synced>” for the Tune it updated a minute ago.

Please advise. I don’t mind if the solution is hacky, as long as it doesn’t take more than 2 additional tasks. Thanks!

Hi @JCV 

Good question.

To help us have more context, please post detailed screenshots with how each of your Zap steps are configured.


@JCV 

You can have Delay steps less than 1 minute.

 


Hi @JCV – I’m thinking that loops run synchronously, meaning instead of it being like: “Run loop 1 and when loop 1 finishes, then run loop 2”, it’s: “Run loop 1, 2, and 3 all at once”. This would explain why it’s only picking up the first search result – each loop iteration is querying your data at the same time (and the delay step is just delaying all of the loops synchronously as well). I would reach out to Zapier’s Support team to confirm that this is the case.

If you have any coding experience (or are willing to learn!), I would suggest using the “API Request (Beta) in Notion” action to send a POST request to query your Tunes database. You would then need to use a JavaScript action to parse the result and get an array of the content in the Name field of each returned database page. And then finally you would use that array, and an array that contains the ids of the pages you want to update, in the create loop from line items.

That solution would add two tasks – one for making the API request, and one for using JavaScript to parse the request.

I hope that helps you move forward! If you decide to go the coding route and need additional assistance, feel free to message me. 😊


Hi @eileenh — Thanks so much for replying & the great suggestion! The two blocks you suggested worked like a charm. I have a bit of coding experience but was wary of diving into code tasks in case it became too complicated. Turns out building & troubleshooting wasn’t too bad at all for this case.

I even managed to save a step because I could update the Tunes directly by ID without having to find them first:

Thanks again for your reply speed & huge assist, Eileen!


You’re very welcome @JCV! Looking at this again, I didn’t catch that Zapier automatically provides an array of object values from an API request. You might even be able to use that directly in the loop step and skip over the code (“split search results into array”) step, if you want to save one more task. In the instance I’ve been testing it seems to add in the , automatically: 

 


Reply