When a story is deleted, I want all linked issues deleted too, however this doesn't seem to work since when a issue is deleted, the reference of the linked issues is lost. Is there a way this can be done with Automation for JIRA?
So ideally the Automation rule for this would simply be:
However in practice this doesn't work, since the 'Issue deleted' trigger arrives after the issue has been deleted and removed from JIRA's search indexes. In order to find the linked issues we have to run the query
issue in linkedIssues("<DELETED_ISSUE_KEY>")
which of course fails, because no issue with the key of the deleted issue can be found any more.
There is one work-around though using Manual Triggers. You can setup a rule as follows:
Project automation - Code Barrel JIRA 2017-01-09 08-32-54.png
So this uses a manual trigger which adds an action on the view issue page called 'Delete linked issues' (in Cloud this will be in the 'Automations' panel on the right. In server it's part of the view issue operations). It then goes and deletes the linked issues first and only after that's done will it delete the current issue from which you triggered the action!
It's not ideal since there's 2 ways of deleting an issue now, but there's not much else we can do to work around this. It's simply how JIRA works.
It started as any story starts, on a normal, rainy day. Admin meets App, and her name was Klok2, and like any first relationship we were both trying to make it work but neither one knew what...
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