How to calculate field values
Automate calculations, i.e., calculate the labor cost estimates based on "man hours" and "hourly fee"
2M 14S
While Jira allows you to create custom fields, it doesn't provide a way to perform calculations within those fields. In this video, learn how to automate calculations using values that appear in your Jira issue’s custom fields using the Issue Field Value Change trigger of Event-based Actions.
For your convenience, the steps from the above video have been outlined below
Build calculated fields to calculate the cost estimates based on data from other fields automatically
Let's say you want to calculate the labor cost estimates based on custom fields that record "man hours" and "hourly fee", and display the result of it in each issue. While Jira cannot automatically do this, you can easily set up a post-function to run this calculation triggered on a field change. This will ensure that the field is always accurate and that it won't require manual calculations. Better yet, this field will automatically adjust if a custom field value that drives this calculation changes. For example, if the number of hours worked increases or the hourly fee changes, so will the labor cost.
First, set up custom fields: "Man hours", "Hourly fee", "Labor cost" (make this last one a read-only field).
Then, automate this calculation using the "Issue Field Value Changed" trigger from Event-based Actions: "Man hours" * "Hourly fee" = "Labor cost".
- Go to Event-based Actions in the JMWE App administration.
- Click on "New event-based action" to create this automation.
- Give it a name, such as "Labor cost estimate."
- In the Event trigger, select "Issue Field Value Changed."
- In Fields to monitor, select "Man hours" and "Hourly fee". Any time one or both of these fields change, the calculation event will be triggered.
- Optional: Select any one or more Projects to apply this to. Leave blank if this applies to all projects globally.
- Optional: You can also select issue types to which this action will apply.
- Click on "Add post function" to configure a post function to perform the action - calculation in this case.

- Choose the "Set field value" post function, and Add.
- Leave "Target issue(s): as is (Current issue).
- In the "Field to set on the target issue" section, select a field to update. "Labor Cost" in this case.
- In the "Value" field, navigate to and expand the "Issue Fields" tab, select "Man hours" in the field dropdown.
- Referred to the field either by Name or ID, click on it to select and insert the proper field - issue.fields["Man hours"] - into the value section. We suggest using field IDs instead of names in case the name is edited in the future.
- In the value section, add * (to function as multiplication).
- Search for and select the "Hourly fee" and click on the proper field to insert it into the value section.

- Press "Save" to save the post function.
- Press "Save" to save your Event-based Action.
- All done.

See it all in action in the video above.
Last updated: 2023-05-22