Very easy, first see this instructions to create the Custom Field
To remove the decimal part of the resulting number from a division of two custom fields for example, and for adding the final character “%”, you can try to set in the “description” of the custom field (of type “Calculated Number”… for example) a code like this:
<!--@@Formula:(issue.get("customfield_XXX") != null ? issue.get("customfield_XXX") : 0)*100/(issue.get("customfield_YYYY") != null ? issue.get("customfield_YYYY") : 1) --> <!-- @@Format: return numberTool.format(Math.round(value*100)/100)+" <b>%</b>"; -->
See the “Format” part, this is used to change the color, the font, etc of the result and to add extra information to the field (like the “%” of the example)
When I try to use this it tells me numberTool is undeclared 😦
LikeLike
The documentation for the plugin states it can be formatted …
Custom formatting
You can also specify custom formatting for the value of the Calculated Number field. In the Description field, add your formatting formula using the following syntax:
The formula itself is a Java-style expression that can reference the value returned by the formula using the value variable. You can also use the numberTool object to format the number value:
numberTool.format(value)
Example:
To display an icon to the left of the field value depending on the field value:
"+numberTool.format(value);
"+numberTool.format(value);
"+numberTool.format(value);
More info21)
return "
else if (value >= 10)
return "
else
return "
-- >;
LikeLike