Trying to get two postman.setNextRequest or two Actions in Workspace

Hi, I’m quite new to postman and was trying to find and piece together many snippets of scripts to make it work the way I want.
What I want is very simple: I have a list of IDs that I want to make a POST in each of them, get one of the responseBody as a variable and do another POST. I think I’m close but I can’t manage to get it to work.

I’ve tried:
Two POST actions in the same Collection and running the collection.
In this the first action I have is a POST to https://APIADDRESS/?order_id={{orderid}}&contract[copy_order_data]=true :

Pre-request Script tab:
var orderids = pm.environment.get(“orderids”);

if (!orderids) {
orderids = [“bc46bf79-2846-44ed-ac4d-78c77c92ccc8”,“81aacc33-1ade-41a3-b23e-06b03b526b8f”];

var currentOrderId = orderids.shift();
pm.environment.set(“orderid”, currentOrderId);
pm.environment.set(“orderids”, orderids);

Tests tab:

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

if (orderids && orderids.length > 0) {
var jsonData = JSON.parse(responseBody);
postman.setNextRequest(“Create invoice”);
} else {

} is a environment variable populated with the response body of the first action/post and then using the variable on the second action/post.

And then the second action would be a POST to https://APIADDRESS/invoices/{{}}/finalize.json:

Of course this doesn’t work.

So I thought that putting the second POST inside the first one would solve it. But without avail

Can please some one help me?

Answering my own question:
What I manage to get it working was using a Json file as a list of Orderids. In that case I’ve separated all requests.

Request1 - https://APIADDRESS/?order_id{{orderid}}&contract[copy_order_data]=true

Tests tab:

var jsonData = JSON.parse(responseBody);

Request2 - https://APIADDRESS/invoices/{{}}/finalize.json

That way everything is in a neat and organized way. Thanks