Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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