TypeError: Cannot read property '0' of undefined in collection runner

3.4k views Asked by At

While executing my script in postman collection runner, I am getting following error TypeError: Cannot read property '0' of undefined .But the same is working fine while executing single script from postman(clicking "send" button instead of executing from runner)

API RESPONSE:

{
    "Result": true,
    "Reason": [],
    "SanitizedData": [],
    "RawData": [
        {
            "name": "area1",
            "warehouse_id": "103",
            "warehouse_name": ""
        }
    ],
    "Columns": [
        "name",
        "warehouse_id",
        "warehouse_name"
    ],
    "S3FileURL": "",
    "mdmLogId": "179"
}

CODE:

var jsonData = JSON.parse(responseBody);
pm.collectionVariables.set("Area_Name", jsonData.RawData[0].name);
0

There are 0 answers