# Why Global Variable return value as null?

**URL:** <https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755>\
**Category:** Miscellaneous\
**Created:** [May 8, 2018, 4:44am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755 "2018-05-08T04:44:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Didit\_Setiawan](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@Didit\_Setiawan](https://forum.katalon.com/u/Didit_Setiawan)\
**Post date:** [May 8, 2018, 4:44am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/1 "2018-05-08T04:44:46Z")

</div>

I create new profile then add several variables there(not on default profile), but when i call the variable for setText it will error because global variable return null value, this is my code

WebUI.setText(findTestObject(‘Register/Register Email/email\_email\_address’), GlobalVariable.Email)

is there anything wrong with my code ?

---

<div class="post-metadata">

**Author:** ![Zarashima](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/zarashima/32/928_2.png) [@Zarashima](https://forum.katalon.com/u/Zarashima)\
**Post date:** [May 8, 2018, 4:57am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/2 "2018-05-08T04:57:06Z")

</div>

You need to use this profile by selecting it from the top right profile drop down, otherwise, these values will be NULL upon executed.

---

<div class="post-metadata">

**Author:** ![Didit\_Setiawan](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@Didit\_Setiawan](https://forum.katalon.com/u/Didit_Setiawan)\
**Post date:** [May 8, 2018, 4:59am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/3 "2018-05-08T04:59:48Z")

</div>

> [Vinh Nguyen](https://forum.katalon.com/profile/33/Vinh%20Nguyen) said:
> 
> Do you switch to use this new profile?

☹ i don’t know about that, always use default profile before  
how to switch the profile ?

---

<div class="post-metadata">

**Author:** ![Didit\_Setiawan](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@Didit\_Setiawan](https://forum.katalon.com/u/Didit_Setiawan)\
**Post date:** [May 8, 2018, 6:05am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/4 "2018-05-08T06:05:03Z")

</div>

> [Vinh Nguyen](https://forum.katalon.com/profile/33/Vinh%20Nguyen) said:
> 
> You need to use this profile by selecting it from the top right profile drop down, otherwise, these values will be NULL upon executed.

can we switch it in code ? because i need to use many profile, calling many testcase

---

<div class="post-metadata">

**Author:** ![Zarashima](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/zarashima/32/928_2.png) [@Zarashima](https://forum.katalon.com/u/Zarashima)\
**Post date:** [May 8, 2018, 6:41am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/5 "2018-05-08T06:41:33Z")

</div>

1. You can’t switch the profile directly in code.  
2. To switch to a profile manually, please select it from this list  
 ![](https://s3.amazonaws.com/katalon-forum/editor/e3/of0p8b7gspey.png)

[Screenshot at May 08 13-37-15.png](https://s3.amazonaws.com/katalon-forum/editor/e3/of0p8b7gspey.png)

---

<div class="post-metadata">

**Author:** ![Didit\_Setiawan](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@Didit\_Setiawan](https://forum.katalon.com/u/Didit_Setiawan)\
**Post date:** [May 9, 2018, 6:27am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/6 "2018-05-09T06:27:52Z")

</div>

> [Vinh Nguyen](https://forum.katalon.com/profile/33/Vinh%20Nguyen) said:
> 
> 1. You can’t switch the profile directly in code.  
> 2. To switch to a profile manually, please select it from this list  
> ![](https://s3.amazonaws.com/katalon-forum/editor/e3/of0p8b7gspey.png)

okay thank you, i will use default profile then

---

<div class="post-metadata">

**Author:** ![Yadav](https://avatars.discourse-cdn.com/v4/letter/y/e9a140/32.png) [@Yadav](https://forum.katalon.com/u/Yadav)\
**Post date:** [September 3, 2018, 10:06am UTC](https://forum.katalon.com/t/why-global-variable-return-value-as-null/10755/7 "2018-09-03T10:06:03Z")

</div>

I am facing the Global Variable returning Value as Null  
I have created a new profile named as “Demo”

![](https://s3.amazonaws.com/katalon-forum/editor/5h/er39cdexigc0.png)  
Though I use the profile “ **DEMO** ” while executing the script  
_ **I am facing below error** _  
[ERROR] - Test Cases/TC02\_HotelBooking\_E2E\_InputDataFromExcel FAILED because (of) java.lang.NullPointerException: Cannot execute null+{HotelURL=[Adactin.com - Hotel Reservation System](http://www.adactin.com/HotelApp/), Screenshotpath=C:\Katalon Studio\AdactinDemo\, Username=xxxx, UserPwd=xxxxx}  
 ![](https://s3.amazonaws.com/katalon-forum/editor/r7/2kplvfq8nirn.png "Image: https://s3.amazonaws.com/katalon-forum/editor/r7/2kplvfq8nirn.png")

My script worked fine till 5.5 version of KatalonStudio, **I am facing this issue on 5.6.3 Katalon Studio**

[Error message.PNG](https://s3.amazonaws.com/katalon-forum/editor/r7/2kplvfq8nirn.png)
