Need help on Tests script

Hi Everyone,
I need some help with a test scrip I use. After a POST call I want to use some of the IDs in another POST call.

This is the test script:

Those are the IDs I need from the response:
image

And this is the error I receive in POSTMAN

Does someone have any ideas what can I try?
Thanks.

That error means you are not targeting the id correct, so its being returned as undefined.

Can you repost the response as text using the preformatted text option in the editor.

Copy it from the body in the response, not the console.

This will enable you to expand the elements out properly, which will help us target the elements correctly.

However, at a first glance. Are you sure that there are two “supplier-information elements” in the response? Suspect there is only one. The console will show it twice. The first line is the object unexpanded, and the second line is the object that you can drill down into.

When targeting elements, use the console log. If you are having issues with an element, console log from the top element and work your way down.

Start with the following…

console.log(response["supplier-information"]);

@michaelderekjones Thank you a lot. You were right, with only one “supplier-information” everything works.
Thanks again.

1 Like