Getting error "TypeError" when setting a Collection Variable

Hello, I am getting an error when running my postman tests.

"TypeError: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type object".

This is my request:


My pre-requisite script has this code:

if (pm.iterationData.get("iterationName") == "TC-02 - Status Code is 400 for Non-Cportal application user") {
    pm.collectionVariables.set("transactionRecordId", (pm.iterationData.get("transactionRecordId")));

Hey @lunar-module-admini7 :wave:

Welcome to the Postman Community! :postman:

Could you expand on the details and context here, please? Are you able to show your full script and the datafile that youโ€™re using in the Collection Runner?

What is the transactionRecordId value here and why are you wrapping that in () when setting the variable?

pm.collectionVariables.set("transactionRecordId", (pm.iterationData.get("transactionRecordId")))

Hi @lunar-module-admini7

With the information youโ€™ve provided, there seems to be a loigic error in that your transactionRecordId collection variable will only be set if the iterationName is equal to โ€˜TC-02 - Status Codeโ€ฆโ€™. So, if iterationName is something else, transactionRecordId will be null.

Thanks @stephenkeenan the issue is resolved.

Thank @danny-dainton the issue is resolved.

1 Like