I’m attempting to run a collection using a data file of about 100 records, but I’m hitting a wall when it comes to the collection variables in the pre-request script. The collection variables themselves are working great, and if I attempt to call them in the request body, they are successfully populated using a CSV file. The pre-request script is also working great, as variables I’m making there are also pulling properly. However, I’m having trouble pulling the collection variables into the pre-request script. Here is what I am currently working with:
orderID = pm.collectionVariables.get("orderID_var"); creativeBase64_raw = pm.collectionVariables.get("creativeBase64_var"); creativeBase64_string = JSON.stringify(creativeBase64_raw); orderName_string = JSON.stringify("Testing " + orderID); creative_name_string = JSON.stringify(orderID + "_creative.html"); pm.collectionVariables.set("orderName", orderName_string); pm.collectionVariables.set("creativeBase64", creativeBase64_string); pm.collectionVariables.set("creative_name", creative_name_string);
At one point those last three lines were globals instead, but I changed them to see if that would help, which it didn’t. If I set the orderID or creativeBase64_raw to a specific string, the body populates what I would expect, so I assume my method of calling the collection variables is just wrong.