Hi,
How do we retrieve the value of a multi-line text custom field using ScriptRunner?
I have been having difficulties retrieving the value from a multi-line text custom field. The code that I have used before does not work for the multi-line:
------------------------------------------------------------------------------------------------
def issueKey = issue.key
// Fetch the issue object from the key
def issue = get("/rest/api/3/issue/${issueKey}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
// Get all the fields from the issue as a Map
def fields = issue.fields as Map
// Get the Custom field to get the option value from
def component = get("/rest/api/3/field")
.asObject(List)
.body
.find {
(it as Map).name == 'Component(s)'
} as Map
assert component : "Failed to find custom field with given name"
// Extract and store the option from the custom field
def component_value = (fields[compoent.id])?.value
I see the cutom field record in the fields query:
"customfield_10119": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "MV Release 1234"
}
]
}
]
},
---------------------------------------------------------------------------------------
I appreciate your help.
Thanks,
--Kent
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.