Subtask created in postfunction not marked as subtask and parent = null

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:

Is there any way to get information about the parent when the subtask is being created by the script runner post function?

1 answer

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


195 views 0 4
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you