Missed Team ’24? Catch up on announcements here.

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

Custom formatting for number field?

Linda_Buck January 28, 2016

Hi guys,

I cannot seem to get the Custom formatting feature to work for JIRA MISC Custom Fields number field.

My code as follows is:

<!-- @@Formula:
test = (issue.get("customfield_10307") != null ? issue.get("customfield_10307") : 0 ) * (issue.get("customfield_10309") != null ? issue.get("customfield_10309") : 0 );
return "<i>"+numberTool.format(test)+"<\i>;
-->

 

Ideally I would like to format the calculated field as a dollar amount, ie $10.00, but I cannot even get the numberTool.format to work on a basic calculation.

I have tried these code scripts with no luck:

<!-- @@Formula:
(issue.get("customfield_10307") != null ? issue.get("customfield_10307") : 0 ) * (issue.get("customfield_10309") != null ? issue.get("customfield_10309") : 0 );
return "<i>"+numberTool.format(value)+"<\i>;
-->

 

I just want to multiple the two number fields and display the value as a currency.  What am i missing?

 

Thanks

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
David _old account_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2016

As stated in  https://innovalog.atlassian.net/wiki/display/JMCF/JIRA+Misc+Custom+Fields#JIRAMiscCustomFields-calculatednumberfield, the @@Formula must return a number (Integer, Double,...) which will be converted internally as a Double.

Formatting takes place in a second comment, using @@Format:

For example:

&lt;!-- @@Formula: 
return (issue.get("customfield_10307") != null ? issue.get("customfield_10307") : 0 ) * (issue.get("customfield_10309") != null ? issue.get("customfield_10309") : 0 );
--&gt;
&lt;!-- @@Format:
return "&lt;i&gt;"+numberTool.format(value)+"&lt;/i&gt;;
--&gt;
TAGS
AUG Leaders

Atlassian Community Events