Summary
Sometimes there are Custom Fields that will return a JSON value
Converting a Custom Field value into a JSON value
When we gather the value from the Custom Field it will be returned as a String value which means that it is currently not possible to manipulate the JSON data. To be able to access the JSON data you will need to use the following command to convert the Text value into a JSON value.
$jemhUtils.createJSONFromSource(String jsonSource)
Using this with a Custom Field value
$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233"))
Extracting a Specific Object value
To extract a specific Object value you will simply need to add the object name to the above .e.g
$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object
You can then also add the next object to return that value by again adding the object name to the end. e.g.
$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object.name
Extracting a specific value from a JSON Array
Sometimes the JSON object may contain an array for a specific object. To access the array value you must specify the Array to get the value by using .get()
and then specifying the Array number e.g. below will return the id that is found within first array in the list.
$jemhUtils.createJSONFromSource($issue.getCustomFieldValue("customfield_10233")).object.array.get(0).id