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

John Kelly September 4, 2015

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?

1 answer

0 votes
John Kelly September 8, 2015

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()
issue.setParentId(id)

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
TAGS
AUG Leaders

Atlassian Community Events