I want to calculate different fields by the selected values of an issue. But some of the calculated fields depend on other calculated fields, so I'm faced with a very complex set of calculations.
To stay with the core problem I will describe a simplified showcase:
- I have an issue with many input fields.
- I have a calculated field "score", that calculates a score from the input fields. So it depends only on the input fields.
- Now I want a calculated field "Key Figure A", that calculates a KPI from the score-field and some other input fields.
- Moreover I want some more calculated fields "Key Figure C...D" that calculate some more KPIs and ratings from the other key figures as well as other input fields.
- There are no circular dependencies between the figures and fields.
Because all calculations are very complex, I don't want to repeat the intermediate calculation steps in each of the descendant KPIs.
So my questions are:
- Is it possible to access another calculated field in the code of a scripted field?
- How does ScriptRunner behave, if I access another scripted field that depends on other scripted fields? Are there any problems to expect if one of the ancestors has to be calculated before the other fields?
- Are there any performance or race conditions to expect?
I would appreciate your experiences, recommendation and alternative solution patterns.
Thank you very much.