gpub1
(gp)
September 17, 2020, 2:47pm
3
allenheltondev:
let iterationCount = pm.collectionVariables.get('iterationCount');
if(iterationCount) {
iterationCount = Number(iterationCount);
}
else {
iterationCount = 1;
}
const jsonData = pm.response.json();
const value = jsonData.**itemid**; // this would be whatever your property you want
let values = pm.collectionVariables.get('values');
if(values) {
values = JSON.parse(values);
}
else {
values = [];
}
values.push(value);
pm.collectionVariables.set('values', JSON.stringify(values));
iterationCount++;
if(iterationCount <= 5) { // This would be your threshold for how many times to loop
pm.collectionVariables.set('iterationCount', iterationCount);
postman.setNextRequest('**GenerateItemid**');
}
else {
pm.collectionVariables.unset('iterationCount');
}
Yes @allenheltondev , i am looking the same thing. Let me run and comeback to you.
i have updated the value and request name. There is too much of “value” text used getting confused