Calculate custom field 1 + custom field 2 by the exchange rate

Albert Manuel
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.
November 10, 2022

Hi there,

I have a Jira DataCenter with ScriptRunner and Automation for Jira i have 2 questions:

1) How can I calculate 2 fields ? Example field 1 + field 2 = result in field 3

2) How can I pull from the web an exchange rate for a currency example from USD to EUR in a field ?

At the end, i would like to calculate field 1 + field 2 and display a sum calculated by the currency exchange rate.

Example:

Field 1 = Man Hours

Field 2 = Labour Hours

Field 3  = Total from field 1 + field 2 - and from here to display the result in a currency.

If the total would be 50 hours and 1 USD = 0.97 euro means i have to pay X amount in euro

Any help would be greatly appreciated.

Thanks

1 answer

0 votes
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2022

This is the documentation for both of your request:

https://scriptrunner-docs.connect.adaptavist.com/jiracloud/scripted-fields.html

For 1, just see the sample that sumps up the story points. Your use case is actually a simplified version of this.

For 2, there is an actual currency conversion example. (There are other public websites with currency exchange rates, but the recipe is the same: send a request to service, then parse out the rate value from the response and multiply the CF value with that.)

Suggest an answer

Log in or Sign up to answer