# Trying to append a string variable to Global variable

**URL:** <https://forum.katalon.com/t/trying-to-append-a-string-variable-to-global-variable/44227>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [June 5, 2020, 5:48pm UTC](https://forum.katalon.com/t/trying-to-append-a-string-variable-to-global-variable/44227 "2020-06-05T17:48:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![vtanguturi](https://avatars.discourse-cdn.com/v4/letter/v/ce73a5/32.png) [@vtanguturi](https://forum.katalon.com/u/vtanguturi)\
**Post date:** [June 5, 2020, 7:19pm UTC](https://forum.katalon.com/t/trying-to-append-a-string-variable-to-global-variable/44227/3 "2020-06-05T19:19:28Z")

</div>

@Russ_Thomas, I saw your solution for similar thing here [link](http://forum.katalon.com/t/how-to-access-a-map-stored-in-globalvariables-map/30919)

how can I create globalvariable for map type at runtime. Currently I am using the following script to create globalvariable for string

> static void addGlobalVariable(String name, def value) {  
> GroovyShell shell1 = new GroovyShell()  
> MetaClass mc = shell1.evaluate(“internal.GlobalVariable”).metaClass  
> String getterName = “get” + name.capitalize()  
> String setterName = “set” + name.capitalize()  
> mc.‘static’.“$getterName” = { → return value }  
> mc.‘static’.“$setterName” = { newValue → value = newValue }  
> mc.‘static’.“$name” = value  
> }

---

_[View the full topic](https://forum.katalon.com/t/trying-to-append-a-string-variable-to-global-variable/44227)._
