# Problem with running a collection - only first request runs

**URL:** <https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209>\
**Category:** Help Hub\
**Created:** [April 26, 2020, 12:39pm UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209 "2020-04-26T12:39:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![taltabtal](https://avatars.discourse-cdn.com/v4/letter/t/22d042/32.png) [@taltabtal](https://community.postman.com/u/taltabtal)\
**Post date:** [April 26, 2020, 12:39pm UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/1 "2020-04-26T12:39:44Z")

</div>

Hello all.

I am running a collection of two requests.  
The first one of them is using a data set in the following way:

* * *

Json Body:

{  
“cloud”: “dummy-cloud”,  
“virtual\_network”: “123”,  
“group\_type”: “scaling”,  
“scaling\_group”: “dummy\_scale\_group\_1”,  
“availability\_group”: “None”,  
“server\_addresses”: ,  
“server\_subnet”: ,  
“fqdns”: “None”,  
“selection\_metric”: “{{ **cur\_val** }}”,  
“health\_check”: “http”,  
“name”: “sg1”  
}

* * *

prerequest script:

var values = pm.environment.get(“values”);

if(!values)  
values = [“val1”, “val2”, “val3”];

var cur\_val = values.shift();  
pm.environment.set(“cur\_val”, cur\_val);  
pm.environment.set(“values”, values);

* * *

and the tests part:

var conn\_metrics = pm.environment.get(“conn\_metrics”);

if(values && values.length \> 0)  
postman.setNextRequest(“Update Server Group”);  
else  
postman.setNextRequest(null);

* * *

 ![ScreenHunter 26-Apr-20 15.22 074](https://us1.discourse-cdn.com/getpostman/original/3X/e/a/ea89aee976b48912fd4505b695fb653f80370782.png)

* * *

The problem is that only the put requests are being executed and the Get requests aren’t.

 ![ScreenHunter 26-Apr-20 15.42 076](https://us1.discourse-cdn.com/getpostman/original/3X/8/6/8664a38ae536f469a8d6d6a9c89dbd050dda8d95.png)

Why?

Thank you!

---

<div class="post-metadata">

**Author:** ![rsganesh](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rsganesh](https://community.postman.com/u/rsganesh)\
**Post date:** [May 12, 2020, 2:28pm UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/2 "2020-05-12T14:28:21Z")

</div>

Me too got struck in the same problem. Appreciate for any help!!!

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [May 13, 2020, 5:55pm UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/3 "2020-05-13T17:55:42Z")

</div>

The code in the pre-request script where you initialize _values_ does not get shared with the test script where you have the if with values.

Use console.log to debug your code.

---

<div class="post-metadata">

**Author:** ![rsganesh](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rsganesh](https://community.postman.com/u/rsganesh)\
**Post date:** [May 14, 2020, 7:27am UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/4 "2020-05-14T07:27:06Z")

</div>

> [@vdespa](#):
>
> _values_

I have checked in console and am not able to find the origin of issue. Can you please specific on that? sharing the above code by correction would be much appreciated.

---

<div class="post-metadata">

**Author:** ![vdespa](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/vdespa/32/2770_2.png) [@vdespa](https://community.postman.com/u/vdespa)\
**Post date:** [May 19, 2020, 4:47am UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/5 "2020-05-19T04:47:12Z")

</div>

Please share your collection.

---

<div class="post-metadata">

**Author:** ![rsganesh](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rsganesh](https://community.postman.com/u/rsganesh)\
**Post date:** [May 19, 2020, 4:54am UTC](https://community.postman.com/t/problem-with-running-a-collection-only-first-request-runs/12209/6 "2020-05-19T04:54:05Z")

</div>

will share with ur personal email as it has confidential information.
