30 Days of Postman - Day 9 - unable to set collectionVariable - undefined

Hello, I am stuck on Day 9 - Scripting - Step 3 " Chain the requests : Return to the Tests tab of the first request to capture the data required for the second request. Use collection variables this time."

I can’t set the collectionVariable “FirstName” with the response from Get Random User. The console just shows “Undefined”. Here is a screenshot of my Tests tab:

Can anyone assist in what I am doing wrong?
Thank you,

In order to get that value from the first property, you need to walk down through the response to the correct reference:


It’s in the the first object, in the results array.

You need to specify that using results[0], then add the name property as it’s within that object, followed by the property name in the object that you want.

1 Like

Thank you Danny! I finally got Day 9 completed! Your answer helped.

1 Like