Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to read Labels field in custom field

Gary Fitzgerald March 20, 2019

I am trying to read the standard Labels field to see if it is null. If the Label field is null I want to return a message saying that the "Client ID is required". I searched and tried many approaches but still no luck. Any suggestions would be greatly appreciated.

<!-- @@Formula:

import com.atlassian.jira.issue.label.Label;

if (label.getLabel() == null {

  return "<b><font color=red>This change cannot be approved until a planned date is specified</b></font>";

        }

-->

 

 

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
March 21, 2019

Try:

<!-- @@Formula:
if (issue.get("labels") == null || issue.get("labels").size() == 0) {
return "<b><font color=red>This change cannot be approved until a planned date is specified</b></font>";
}
-->
Gary Fitzgerald March 21, 2019

Thanks so much. Works great!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events