# Loop stops executing randomly

**URL:** <https://community.postman.com/t/loop-stops-executing-randomly/59018>\
**Category:** Help Hub\
**Tags:** loop, postman-flows\
**Created:** [March 19, 2024, 8:32pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018 "2024-03-19T20:32:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 19, 2024, 8:32pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/1 "2024-03-19T20:32:35Z")

</div>

Hello

I am appreciative of all the help from the community so far.

I am trying to set up a job to loop through the results of a request and send two requests based on criteria from the original request but it stops executing at a certain point for some reason and I cannot figure out why.

Here is my Flow

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/8/0/8069040857742cc02e0a432a17148c4052f5c6f0.png)

Close up of the loop

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/5/c51c25bddbf3f1cd9b92bc182a3be5957e0dd70d.png)

And here is my log

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/9/d/9d4bed3104ffcdc3e8dc27b2e00d759438ad94e8.png)

It just stops executing at the same truck VIN  
Thanks

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [March 20, 2024, 12:58am UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/2 "2024-03-20T00:58:12Z")

</div>

Hi @legiuffre

A couple things I can suggest:

1. Your delay blocks aren’t properly connected, it needs to have some data connected to it to _delay_ it’s transmission. See the below image:  

2. A lot of the time if the loops are causing issues, it’s best to make a copy of your flow (duplicate in the flows selection pane by clicking the three dots) and then replace using variables with using the values directly with a select block instead to see if that’s the issue.

---

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 20, 2024, 12:48pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/3 "2024-03-20T12:48:35Z")

</div>

Hello again

I am trying to do what you said and got to the second part of your suggestion but it doesn’t appear I can connect my select statements to the next Send Request block as seen in this article: [Send data between blocks in a Postman Flow | Postman Learning Center](https://learning.postman.com/docs/postman-flows/concepts/passing-information-between-blocks/)

Am I doing something wrong? How do I move the values from my select statements into the Send Request?

---

<div class="post-metadata">

**Author:** ![legiuffre](https://avatars.discourse-cdn.com/v4/letter/l/b9e5f3/32.png) [@legiuffre](https://community.postman.com/u/legiuffre)\
**Post date:** [March 20, 2024, 5:48pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/4 "2024-03-20T17:48:04Z")

</div>

Hello again

I had to recreate the flow from scratch to get it to work the way you advised but the loop is still stopping. Here is my new setup

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/f/e/fe78ad1a079d453df89bfa83c7119e512b5a9a4f.png)  
Last part that is cut off from above to show the end of it:  
 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/d/7/d720d455bcc6dd1c6a5ff05e89427e1872a8d307.png)  
I imagine I am not using the If correctly however I am not sure I understand how they are fully supposed to work within the context of what I am trying to do

---

<div class="post-metadata">

**Author:** ![flows-daniel](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/flows-daniel/32/25516_2.png) [@flows-daniel](https://community.postman.com/u/flows-daniel)\
**Post date:** [March 20, 2024, 6:13pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/5 "2024-03-20T18:13:17Z")

</div>

@legiuffre

I annotated the flow you have, connect all the ports circled in purple from the green port instead of the red port.:

 ![image (3)](https://us1.discourse-cdn.com/getpostman/original/3X/a/5/a5c755eaa967fb9a414bd1534e386bdcb23a3e1d.png)

The reason this is likely happening is because the ports in purple are being triggered every iteration, whereas the other input is coming through _only_ when the condition is true.

If you’re still having issues after making the change, feel free to send me a DM and we can setup a debugging call to see what else might be causing this.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [April 19, 2024, 6:13pm UTC](https://community.postman.com/t/loop-stops-executing-randomly/59018/6 "2024-04-19T18:13:49Z")

</div>

Closed on April 19, 2024, 6:13pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
