How can I insert a global variable into the http body of a web service request

Hi there!

I am just wondering if there is a way to insert global variables into the HTTP body instead of a local variable. Currently, I need to insert a local variable into the body that is mapped to a global variable in the “variables” tab. I find it repetitive adding the same variables in each case.

Current Code: “token”:"${token}"
What I want it to be like: “token”:"${GlobalVariable.G_VAR_token}"

I have tried the above global variable call and it does not work. It does work in the URL section though!

Thank you!

put ${GlobalVariable.G_VAR_token} as default value in variable definition, if i remember correctly this should work.
like this:

Hi, thanks for the reply. But I do not want to have to add local variables which reference the Global Variables every time I create a new Web Service Request (I have hundreds). I just want to reference straight to the global variables, how can I do this?


In I found a screenshot

This is what you want, isn’t it? It should work for you.

Do you have 2 or more Execution Profiles prepared? Are you sure you selected an appropriate “Execution Profile” when you execute your test? If you mistakenly selected inappropriate Executiion Profile, your test might find a GlobalVariable undefined.

Yes that is what I want but it is simply not working. I have ensured the execution profile is set to the correct one also… Are you sure Katalon has functionality to allow global variables in the HTTP body?

can you share any logs from excutuion?

Yes. I checked on my pc and found it is working. See the following screenshot.


Could you share your screenshot?

1 Like

Turns out I was not referencing the variable correctly. Thank you!