I have a system-wide java listener that records information about issues as they are created. If I'm on a standard issue and do "More>Create Sub-task" the listener sees the create event and records the new subtask and doing things like subtask.getParentObject() or subtask.isSubtask() work as expected.
However, if the subtask is created using the "Create sub task" post function from script runner, my listener responds to the create event, but does not see the newly created issue as a subtask. getParentObject() returns null and isSubtask() returns false. I've tried to re-get the issue from the issueManager but that did not work.
I imagine this is related to: https://jamieechlin.atlassian.net/browse/GRV-346
Is there any way to get information about the parent when the subtask is being created by the script runner post function?
I found the following workaround so that I do not need to make any changes to the listener. In the additional actions field on the Create Sub-Task post-function, I simply set the parent ID of the newly created issue like so:
long id = transientVars["originalissueobject"].getId()
When the listener runs it now sees a parent when running getParentObject() or isSubtask(). I'm guessing the parent ID or parent object gets overwritten a split second later by the scriptrunner postfunction, but this was enough to get around the issue I was encountering.
Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs