How to used nested for loops in Postman Flows

Hi @apoleon

To solve the ordering issue see the below flow:

I used placeholder requests but the logic should be the same. First connect the success port of the send request block to the “start” port of the loop so it only runs after the chapter has been created. If timing is important you can add a delay block before/after the middle request to have the data “pause” for a specified amount of time before continuing.

Additionally I believe your flow will get stuck because the MSID variable is being set multiple times and variables currently behave like constants in Flows and aren’t meant to be set multiple times in a flow (we have an open feature request for this).

A workaround to that issue is to add the MSID to every element that’s sent to the second for loop which would give you the following below:

The $map function adds the MSID to every element of the list so instead of passing just “Subtitle 1” it would be a record containing { "subtitle": "Subtitle 1" , "MSID": "msid here"} which can then be selected on the other side.

The Code in the evaluate block is below:

$map(list, fn($e){
    {"subtitle": $e,
    "MSID": msid}
})

Let me know if this works for you or if you have any questions.