Hope you're well!
I've just tried to set up an automation rule whereby, if a user enters or edits a number in the Number field (in my Next-gen software project) in an Epic, then another field multiplies that by 1.1871.
I ultimately need the user to put in a cost estimate into Field 1, and then let Jira Automation multiply that by 1.1871 and put the answer automatically into Field 2 (to show the USD $ conversion).
You'll see in my attached image that I've only got so far, as I assume (and hope!) that there is code that I can enter into the 'Additional fields' text area, that will allow me to make this automation come to life.
Looking forward to hearing from someone, and let me know if you have any questions.
Hi Mykenna, I knew there'd be an easy what to do this, thanks for this!
However, as I am new to coding and Jira query, please can you explain what each section of the code is for the Multiply option? This is the code I can see on the link you've provided for Multiply -
So please can you explain what each section is and means? Thank you!
So "now" is a function related to the current time. That's not helpful for your use case.
Try something like this:
which can also be written as:
In the context of the rule, it would look like this:
In this case, I'm setting the "SOW hrs" field based on what is in the "Story Points" field. Change those to match the fields you are using.
I couldn't get the syntax using "*" instead of the multiply() function to work.
Hi Mykenna, perfect, I've managed to set this up my side, thank you so much for explaining it!
One last question, do you know why the system (looks like) it's only multiplying by 1.18 rather than 1.1871? For example, with the new rule, 63,000 multiplied by 1.1871 is showing as 74,339.997 in my field (as the calculated answer), rather than 74,787.30.
Do you know why this is?
I thought at first it was to do with decimal places, but it looks like the system is rounded the 1.1871 down to 1.18 only.
Let me know what you think! Thank you!
I updated my test rule to multiply one field by 1.1871 as you are doing. Putting 63000 in that field and running my test rule showed a result of 74787.303 when I viewed the issue, which is much closer to the result you what. I'm not sure why you are seeing something different. Perhaps recheck your numbers and retest?
I did find that there are various claims about Jira using high accuracy in the database for numbers (maybe 6 digits past the decimal or more, which seems like enough for your needs), but displaying only 3 past the decimal after rounding up when viewing issues. That still doesn't explain what you're seeing.
_ _ _
One common trick used when dealing with currency values is to multiply everything by 100 (to convert dollars to cents), do all the math, round the result to an integer, and finally divide by 100 as the very last step (to convert integer cents back to fractional dollars).
The "round" function in automation rule smart values performs the rounding up-or-down operation. There is an example in the documentation link I provided earlier in this thread.
In your example, this would give: 6,300,000 * 1.1871 -> 7,478,729.999 and rounding to an integer gives 7,478,730 and finally dividing by 100 is the result you want: 74,787.30
All that math is possible using Smart Values in the rule. Maybe give that a try?
Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...