I have a web panel created through scriptrunner that I want displayed only if a customfield has been populated with a value.
I've been trying to use condition to no avail
Tried setting condition in script to :
cfValues['Priority Score'] > 0
But I get a cfValues is undeclared in the code box and regardless of value the web panel doesn't show.
How do I properly reference the custom field "priority score" in a condition
I'm not Script Runner expert, but let me try to help.
Where do you find or set cfValues?
I think you should write a script to get the custom field value and return true if the field has value as below.
Please be aware that I did not try the code, I just write it here.
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager()
CustomField cf = customFieldManager.getCustomFieldObjectByName('Priority Score')
return null != issue.getCustomFieldValue(cf)
Thanks Tuncay, that got me on the right path
This is what ended up working :
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cField = customFieldManager.getCustomFieldObject("customfield_10504")
def cFieldValue = issue.getCustomFieldValue(cField)
cFieldValue != null
Learn how to use two new reports for next-gen projects in Jira Cloud: Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events