How to run next collection multiple time

Hello Everyone,
I am getting an array as a response. Now I want to post the data to the slack for each object inside that array.
I want to know how to run a postman.setNextRequest(‘COLLECTION_NAME’); multiple times so that I can post the data multiple time.

array.forEach((item,index) => {
    postman.setNextRequest("Post Data to Slack")

This code is overwriting the photo_thumb environment variable and postman.setNextRequest run only one time and it post only last data of the array.
How should I run the post request multiple times?
Or please tell me some other way of doing that.
Thank You

   //assume this is the response array 
   array = [1, 2, 3, 4, 5]

    if (!Number(pm.environment.get('temp'))) {

        pm.environment.set("array", array)

        pm.environment.set('temp', 1)


    let arr = pm.environment.get("array")


    if (arr.length !== 0) {

        if (arr.length !== 1) {



        pm.environment.set('value', arr.pop())

        pm.environment.set("array", arr)

    } else {

        pm.environment.set('temp', 0)


You cannot use it in a simple for loop , instead create a varaible ‘temp’ with value 0 , ( One time setup)

1 Like

Thanks for your reply