# Postman Flow Repeating Requests With Variable

**URL:** <https://community.postman.com/t/postman-flow-repeating-requests-with-variable/56387>\
**Category:** Help Hub\
**Tags:** variables, postman-flows\
**Created:** [January 9, 2024, 6:07pm UTC](https://community.postman.com/t/postman-flow-repeating-requests-with-variable/56387 "2024-01-09T18:07:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![payload-cosmologist5](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/payload-cosmologist5/32/27053_2.png) [@payload-cosmologist5](https://community.postman.com/u/payload-cosmologist5)\
**Post date:** [January 9, 2024, 6:07pm UTC](https://community.postman.com/t/postman-flow-repeating-requests-with-variable/56387/1 "2024-01-09T18:07:18Z")

</div>

Hiya! Im creating a postman flow with two different post requests, and im trying to get it to create an extra request afterwards where im looping through the list of memberIds and using the bendeId for each request.

But currently it runs succesfully on the first memberId, but then it hangs. It looks like its trying to get a different gangId since both the memberIds are getting logged after the for loop?

The log:  
18:57:39.037 ▶{bendeId: “659d8907f57bc6a8b1d0e526”, memberIds: [2]}  
18:57:40.113 659d8907f57bc6a8b1d0e527  
18:57:40.113 659d8909f57bc6a8b1d0e529

The flow:

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

Im quite new to the whole flows thing so idk what 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:** [January 9, 2024, 6:43pm UTC](https://community.postman.com/t/postman-flow-repeating-requests-with-variable/56387/2 "2024-01-09T18:43:32Z")

</div>

Hey @payload-cosmologist5

Welcome to the forums!

It looks like what’s happening in your flow is the `bendeid` is sent only once but the `memberid` is sent multiple times. Flow’s blocks expect every variable to be input in order to run again. In this case the For block provides the `memberid` multiple times but the `bendeid` is only sent once.

The easiest workaround is to use a FQL [$map function](https://learning.postman.com/docs/postman-flows/flows-query-language/function-reference/#map) which can add the `bendeid` to each `memberid` and return a list of objects that holds both.

Your code would look something like this:

```auto
$map(memberids, fn($e){
    {"memberid": $e,
    "bendeid": bendeid}
})

```

The flow would be something like this:

 ![Screenshot 2024-01-09 at 10.39.43 AM](https://us1.discourse-cdn.com/getpostman/original/3X/a/1/a124b0237d3b92b4284e0edb3abedc14ec347fc7.png)

Let me know if this works for you.

---

<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:** [January 12, 2024, 6:43pm UTC](https://community.postman.com/t/postman-flow-repeating-requests-with-variable/56387/3 "2024-01-12T18:43:38Z")

</div>

Closed on January 12, 2024, 6:43pm UTC

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