Setting collection variable script not working even if using the correct syntax

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question: I was facing a problem in my Postman Application. I wrote a script to extract a data from a Json response and set it in the collection variables, though the script is passing…but I am unable to see the same in my collection variable section. Also when I am trying to create a new variable from the collection variable section itself, on selecting a text and clicking on set as variable, the extracted variable is showing in the collection. Weird issue! Can anybody help?

Details (like screenshots):

How I found the problem:

I’ve already tried: