Hello,
I'm trying, using ScriptRunner, programmatically obtain value from Epic Colour customField, but I'm failing miserably
I've tried using
Issue epic; //100% sure this issue is an Epic and has selected Epic Colour
CustomField cf_epicColour; //100% sure Epic Colour cf
epic.getCustomFieldValue(cf_epicColour); //Returns null
cf_epicColour.getValue(epic); //Also returns null
And nulls every time when I do so. (when at the same time, I can clearly see this values are set - either chcecking it via REST API or searching with visible Epic Colour column)
{"expand":"renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations","id":"10001","self":"http://localhost:2990/jira/rest/api/2/issue/10001","key":"DEV-2","fields":{"customfield_10004":"ghx-label-3"}}
Unfortunately I can not use REST APi call, that's why I want to get this field value via CustomField class or any diffrent class avalaible (https://docs.atlassian.com/software/jira/docs/api/7.13.1/index.html?)
Does anyone has any ideas how to get this value?
When in doubt, simplify... can you run the following script in your Scriptrunner console?
import com.atlassian.jira.component.ComponentAccessor
def epicKey = 'JSP-1661'
def epic = ComponentAccessor.issueManager.getIssueObject(epicKey )
def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName('Epic Colour') //12208
if(!epic){
return "Epic not found"
}
if(!cf){
return "Epic Colour not found"
} else {
log.info "Epic cf found: id=$cf.id"
}
epic.getCustomFieldValue(cf)
If you don't get a value like "ghx-label-n", then what's in the log?
To be honest I don't really know why it didn't work for me before...
But, it works now with your method (which isn't really that different from mine)
Thank you very much kind sir ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.