TerryHe
9 years agoNew Contributor
How to get value from a Map returned by Groovy Script in Request
In the groovy script step, i returned a Map type value as: =========================== def serverSessionIdVal = "${java.util.UUID.randomUUID()}"; def clientSessionIdVal = "${java.util.UUID.randomU...
- 9 years ago
Hi,
With the specific approach you have taken I am uncertain what syntax to use at this point. However, I would normally do what you hopefully want a slightly different way using the context map to hold your custom map:
def serverSessionIdVal = "${java.util.UUID.randomUUID()}"; def clientSessionIdVal = "${java.util.UUID.randomUUID()}"; vars = [:] vars["sid"] = serverSessionIdVal vars["cid"] = clientSessionIdVal context.vars=vars return vars
Then you can access the map values in a request with the following syntax:
${=vars.cid}
and
${=vars.sid}
Regards,
Rupert