I need to update a custom field value in the parent of a recently deleted issue in the Issue Deleted script listener of such deleted issue.
I've tried almost everything but with no success yet.
Thanks,
Hi @Asimetrix Atlassian ,
Welcome to the Community! Can you please share more details about the script? What's the custom field in the parent issue that needs to be updated? Does Jira let you edit that field if you try to update it manually? Are you getting any errors?
Thanks a lot... I need to update the count of child items of the parent whenever a child is created or deleted.
I could easily make it in the creation, but I can't find a way to access the parent key of a deleted issue (issue.getParentObject() or any other way) as to re-count.
I know how to easily do it via automation rules, but this client wants to use ScriptRunner as much as possible.
Thanks in advance,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Asimetrix Atlassian
as you said, you cannot reference the full issue object for an issue that has been deleted and the trick is to reference directly the parent instead.
The script context gives you access to an issue entity of type java.util.Map, it means the issue data is provided as a JSON payload, essentially a nested map of maps.
You can still access all fields (including the parent key and issue type information) through standard Groovy map notation.
You can then reference the parent without having to go through the deleted issue
def issueToUpdate = Issues.getByKey(parentKey as String)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.