Hi,
I want to use a Postman Flow to automate a manual task.
The task contains the following actions:
1/ Create a Chapter (POST request)
2/ Create a subtitle for the Chapter (another POST request)
A subtitle can only be create after the creation of a chapter because the chapter id is needed to create the subtitle
The number of chapters and subtitles depends on 2 lists part of the flow.
The first list contains the chapters, the second list contains the subtitles.
How can I first loop on the list of chapters and for each chapter loop on the list of subtitles?
First create: Chapter 1 - SubTitle 1.1, SubTitle 1.2
Than create: Chapter 2 - SubTitle 2.1, SubTitle 2.2, SubTitle 2.3
Currently I combine 2 for loops but first all chapters are created and after that the subtitles are created.
Chapter 1 - Chapter 2 - SubTitle 1.1, SubTitle 1.2, SubTitle 2.1, SubTitle 2.2, SubTitle 2.3
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.