I'm writing a workflow to fetch a number of pages from a REST api. I'm struggling to work out how I can repeat a query in a workflow incrementing the page number each time it repeats until all pages have been fetched. I don't seem to be able to create a loop back to repeat a query multiple times.
I'm sure there must be a simple solution to this as I'm sure it's a common use case. I would appreciate any pointers you might have on achieving this in workflows.
I did look at loops but it only seemed to be for looping over results of a query, rather than repeating a query a number of times. I will take another look as I may have missed some feature of it.
If it helps, you could perhaps create JavaScript Code Block with the number of pages and loop through them to get all the information you need and proceed from that point onwards.
So you could accomplish this with 1-2 workflows depending on the use case.
1st workflow would on cadence trigger the second workflow (if you want it to be happening automatically).
2nd workflow would be triggered by webhook and if results are found, actions would be performed and then it would trigger itself or wait the first workflow to trigger it.
So in my example test_table had 3 records, workflow went and each run dropped 1 record, when there are no records the loop behavior breaks.