How to change the flow of execution dynamically across folders in a collection or different collection

Hello,

We have a scenario where our collection would look like this:

Collection1
||
Folder1
||
Request1
Request2
Folder2
||
Request1
Request2
Folder3
||
Request1
Request2

Now if we run the collection, Folder1–>Folder2–>Folder3 would be executed

But based on a condition if we want to change the execution during the run like

Folder1–>Folder3–>Folder2 how can we do this?

Came across pm.setNextRequest but i understand this requires the request names under each folder to be unique. But thats not the case with us. Any help appreciated

1 Like

Hello @RagaDeepika,

Welcome to the Community :partying_face:

Seems like an interesting use case,

  1. Is there any option to rename your requests, like adding the folder name or some other text to differentiate the requests under three folders?

Because that will be easy, and as you quoted above we can directly use β€œpm.setNextRequest”.

  1. You can try to read the folder names, which is currently a open feature request in GH.

But I found a post with a workaround.

This way you can access each folder and write some logic to run in the flow as per your need :grinning:

this might not solve your problem completely, but you can try to implement this approach :blush: All the best!