Hello everyone, I have a Retool workflow that makes an API call to fetch details using an ID in a loop. The loop iterates through the IDs, but when it fails to find details for the first ID, the entire process stops, rather than continuing to check the remaining IDs in the array.
Hi @Theodora_Utomudo! Are you using the built-in "Loop" block or a raw JS script?
If the former, there is a toggle in the block settings that should control whether the loop continues or exits upon hitting any errors.
If the latter, I'd recommend wrapping the API call in a try...catch block in order to prevent any errors from bubbling up and terminating the process.
I hope that helps! Let me know if you have any follow-up questions.
1 Like
Thanks Darren, i will try this out.
1 Like
I just serendipitously wrote a small bit about how to use the workflow functions and the new Loop block's Run JS Code to better handle loop errors and successes:
This is pretty much the same answer from Darren but blending the Loop Block and the Raw JS with a step-by-step process.
2 Likes