Hey guys,
I already tried to read my way through Adaptavist documentation and a couple of your threads here in the community but I honestly don't know where to start.
Let me explain my idea first:
I have a main task with a custom number field (A). One can create a sub task with a different custom number field (B) when certain conditions are met.
Once the sub task is successfully created the Value of A needs to be updated. It should show B subtracted from A.
So, visually explained: The parent task field A has a value of 50. After a successfull creation of a sub task with B=20, the value of A should be reduced to 30.
If a sub task is changed later on, it should also check the conditions.
If a sub tasks is "cancelled", the value of B needs to be added to A again.
First I thought I use Scripted Fields to solve this problem. But I read - I believe here on the community - that this will produce a heavy load every time the task is handled by the system (index, search...). My search brought me to ScriptRunners "Listeners" but I do not know how to start this off properly. It sounds like a custom listener in combination with an update.issue() event sounds like the way to go.
Any chance that you can help me out? Or point me in the right direction? I can usually read scripts/code and understand it, but writing my own seems to be quite the challenge.
Do you have Jira Suite Utilities licensed?
If you do, you might get cracking by just using workflow mechanics.
Option 1: You create a workflow transition on the parent issue itself, having a status like "Still valid" and a transition from this status to itself. On this transition, you could create a corresponding subtask and do the math on your custom field with some groovy script via post functions. You could even add a condition on subtask creation making sure *A* is still > 0.
Option 2: You let the user create the subtask themselves and use groovy script to identify the parent issue and update *A*, again on a workflow transition of your choice.
Both options should only crunch numbers once.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.