# How to access a Map stored in GlobalVariables Map

**URL:** <https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [August 5, 2019, 9:29pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919 "2019-08-05T21:29:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian.leone](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@brian.leone](https://forum.katalon.com/u/brian.leone)\
**Post date:** [August 5, 2019, 9:29pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/1 "2019-08-05T21:29:35Z")

</div>

I’m new to Katalon. I’ve recorded a test case, and I am editing it to make it easier to use to test multiple environments. I have created a profile for one of the environments to test against, and created global variables for the test case to use. For simple variables, like a user’s first name, I created a string variable, and that’s easy to select for input in the test case.

I also created a mapped object called taxable address that represents a shipping address (i.e. street, state, zipcode, etc.) But for the global mapped variable, I can’t select any of the mapped properties - only the object name (taxable address) itself.

I have searched for a while but can’t find a example of using global mapped variables in a test case. How do I reference the mapped properties in the test case UI input?

 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/a/ac72346b050e399337d22023e65e1b02fc35ef06.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/6/6148bcf515a8d46e1a68a8efeeb1f366882d8fd0.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/8/8f449be26d92879ad60ae7cae861d75bb008163d.png)  
 ![image](https://europe1.discourse-cdn.com/katalon/original/2X/6/63e5bda523ce7327b3e0108751e92009dfbe0980.png)

---

<div class="post-metadata">

**Author:** ![aplui](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@aplui](https://forum.katalon.com/u/aplui)\
**Post date:** [November 13, 2019, 2:56pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/2 "2019-11-13T14:56:50Z")

</div>

Hi Brian, I have the exact same question. Did you ever find a solution?

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 13, 2019, 3:34pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/3 "2019-11-13T15:34:08Z")

</div>

It’s a shame no one jumped in to help @brian.leone with his original problem. Brian, if you’re still around, we’re not normally so neglectful 😕

Okay, what we have here is a Map called `GlobalVariable` which contains a Map called `TaxAddress`.

This code will retrieve the `TaxAddress` map from the GlobalVariable map so that it can be handled separately:

```javascript
Map taxaddress = GlobalVariable.TaxAddress

```

If you’re feeling ultra-pedantic:

```javascript
Map taxaddress = (Map) GlobalVariable.TaxAddress

```

Once you have `taxaddress`, then you can access the members like so:

```javascript
println taxaddress["Street"]

println taxaddress.get("Street")

```

[https://www.tutorialspoint.com/groovy/groovy\_maps.htm](https://www.tutorialspoint.com/groovy/groovy_maps.htm)

---

<div class="post-metadata">

**Author:** ![brian.leone](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@brian.leone](https://forum.katalon.com/u/brian.leone)\
**Post date:** [November 13, 2019, 3:44pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/4 "2019-11-13T15:44:38Z")

</div>

Hi Russ! Ok, thank you I will give that a try!

---

<div class="post-metadata">

**Author:** ![brian.leone](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@brian.leone](https://forum.katalon.com/u/brian.leone)\
**Post date:** [November 13, 2019, 4:24pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/5 "2019-11-13T16:24:15Z")

</div>

That worked perfect for me. I also saw that instead of mapping to a local variable I could access the GlobalVariable object :  
GlobalVariable.TaxAddress[‘Street’]  
Thanks again!

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 13, 2019, 4:56pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/6 "2019-11-13T16:56:55Z")

</div>

Yep, that’s fine too. There are purists (the syntax police) that will insist that one way is better than another but once you’ve found a pattern that works, my advice is stick to it. If it causes an issue later, find a better one.

This is _test code_. Be pragmatic. 🕶

---

<div class="post-metadata">

**Author:** ![Russ\_Thomas](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/russ_thomas/32/11884_2.png) [@Russ\_Thomas](https://forum.katalon.com/u/Russ_Thomas)\
**Post date:** [November 13, 2019, 4:58pm UTC](https://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919/7 "2019-11-13T16:58:03Z")

</div>


