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)

Posted by:.

2 replies on “How to set format to the value of a Custom Field calculated in JIRA with JIRA MISC addon

    1. 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:

      21)
      return " "+numberTool.format(value);
      else if (value >= 10)
      return " "+numberTool.format(value);
      else
      return " "+numberTool.format(value);
      -- >;
      More info

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s