How to set a global variable from an API response

Hello,
Im trying to set token in global variable which is getting from another response
i have created a global variable token
image
this is my test case where im passing value to global variable


here im able to print the value but its not set for global variable
image
Im not able to set the token value to that respective global variable.
i mean get the token value from response and set to global variable

Please show us the proof of this. For example, you can change your code slightly as this:

GlobalVariable.token = value
println("value=" + value)
println("token=" + GlobalVariable.token) 

Then what do you see in value=xxxxxx and token=yyyyyy?

I guess, you will see xxxxxx and yyyyyy to be equal, aren’t they? If yes, it means that you successfully updated a GlobalVariable with a value. I wonder what you are wondering about.

@kazurayam yeah both are same but the thing is i cant able to find the same value in executable profiles
image
here in console im able to figure it


but im not able to see the value in executable profile

`

No.
This statement
GlobalVariable.token = value
will NEVER update the Execution Profile on disk.

Katalon Studio does not offer capability to persist the current status of GlobalVariables into disk.

A Execution Profile defines a list of the name, type, and initial value of GlobalVariables. Here by the word initial I mean when a Test Suite started.

A Execution Profile is not a database on disk which stores the values of GlobalVariable dynamically updated during a TestSuite run.

@kazurayam okay got it thank you.