Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

JMCF set text based on value



have the following code in production:

if (issue.get("customfield_14203")==null || issue.get("customfield_10102") == null)
return null;
return (issue.get("customfield_14203") - issue.get("customfield_10102"));

and it works fine. it returns a number of days (ex 10; -2)

Instead of this, i need to return a text, based on the value as folloiwng:

“Overdue” if the result >=0.1

else “On Time”.


can you please give me some help?





1 comment

Hi @Antonio Caeiro ,

two possibilities:

- you want to create a new Calculated Text field to show Overdue or On Time, based on the calculation. For that, you can use this formula:

if (issue.get("customfield_14203")==null || issue.get("customfield_10102") == null)
return null;
return (issue.get("customfield_14203") - issue.get("customfield_10102")) >= 0.1 ? "Overdue" : "On Time";

- you want to keep your Calculated Number field as is, but simply display the value as Overdue or On Time (while sorting, searching, and exports will still be based on numbers). In that case, you can use the "Velocity Template" and "List View Velocity Template" configuration options with that code:

#if ($value >= 0.1)
On Time
Like Antonio Caeiro likes this

Hi David. It works fine. tks for the tipimage.png


Log in or Sign up to comment

Atlassian Community Events