Postman Flow Repeating Requests With Variable

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 :arrow_forward:{bendeId: โ€œ659d8907f57bc6a8b1d0e526โ€, memberIds: [2]}
18:57:40.113 659d8907f57bc6a8b1d0e527
18:57:40.113 659d8909f57bc6a8b1d0e529

The flow:

Im quite new to the whole flows thing so idk what to do.

1 Like

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 which can add the bendeid to each memberid and return a list of objects that holds both.

Your code would look something like this:

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

The flow would be something like this:

Let me know if this works for you.

2 Likes

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