Hi everyone.
I am writing some code to access fields but it is not working.
First off this code is in the Initializer section of a behavior.
In the code below at line 14 I am trying to get the value of the sys "Work Item Type" field but it is returning null. I know at this point no selection has been made but I would think it would return the default value.
On line 20 I am trying to get access to the current issue to get a hook into the custom fields.
It is also failing.
Any help would be appreciated.
Thanks,
C.J.
It's will work on Listener like that
if(issue.fields.issuetype.subtask == true){
String parentkey= issue.fields.parent.key
}and if you are in script console do this:
def issueKey = 'COPY-19' // enter you sub task key here
def result = get('/rest/api/2/issue/' + issueKey)
.header('Content-Type', 'application/json')
.asObject(Map)
if (result.status == 200){
def parentIssue = result.body.fields["parent"]
return parentIssue["key"]
} else {
return "Failed to find issue: Status: ${result.status} ${result.body}"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.