Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete related issue with Automation

Dag Atle Stentad October 3, 2024

Hi Community!

We have a custom field in Jira that contains the value of another Jira-key.

If an issue that has a value in this field is deleted, I want to delete the issue that is named here as well.

2024-10-03 14_28_31-Window.png

However, when I run the rule, it fails with the following error:

error.png

I’m a bit unsure why it has added "AND (key != TSU-457)" to the query.

Is there any way to solve this?

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2024

Hi @Dag Atle Stentad 

First thing, I recommend not deleting issues from Jira Cloud.  There is no built-in "undo" or trash bin capability, and so mistakes are possible.  Instead consider using a resolution value or custom field to indicate "abandoned" issues, and update filters / reporting accordingly.  Then the "delete issue" permission may be removed from all users except Site Admins.

I recommend pausing and discussing this rule and the problem you are trying to solve with your Jira Site Admin for advice.

 

Back to your original question...

Some rule components such as Branch on JQL explicitly exclude the trigger issue.  This is to prevent errors, such as looping or walking over prior results.  That is why you see that expression added to the JQL: key != TSU-459

Next, the issues you show are in different projects.  What is the scope of your rule: single-project, multiple-project, or global?  A single-project scope rule cannot access issues in other projects.  To change the rule scope, your Jira Site Admin will need to help.

Kind regards,
Bill

Dag Atle Stentad October 3, 2024

Hi @Bill Sheboy Thanks for the response and tips. I agree with you regarding best practices for deletion, but in this case, we want to delete the issue + the related issue.

The rule is set up to run "Global." Since it adds "!= TSU-459" and this one has already been deleted, Jira Automate stops, so we can't proceed. Is there another way to perform an action on the related issue?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2024

Thanks for that reminder, and this edge case is a known problem.  You may watch / vote for this defect to see progress on resolution: https://jira.atlassian.com/browse/AUTO-361

 

One possible workaround for your scenario is to call the REST API endpoint using the Send Web Request action.  That will eliminate the need for the branch and so prevent the error.

If you want to try that approach, here is a how-to article and the relevant endpoint needed:

Like Dag Atle Stentad likes this
Dag Atle Stentad October 7, 2024

Thanks @Bill Sheboy, that was a good idea for a workaround 👍

Like Bill Sheboy likes this
0 votes
Cristian0791
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 3, 2024

Hi Dag,

You can try with: Key = {{customfield_10547}}

Also if the issue/s are in different projects please ensure that the Rule is Global.

 

OR

Create a variable

variable.png

 

 

Hope this helps.

Dag Atle Stentad October 3, 2024

Hi! 

Thanks for the quick reply. Unfortunately, it didn’t help. We get the correct issue key from the custom field, but it still automatically adds the deleted IssueKey in the query. See the audit log below.

2024-10-03 15_42_17-Audit log - Automation - Jira og 5 sider til – Arbeid – Microsoft​ Edge.png

2024-10-03 15_39_18-Audit log - Automation - Jira og 5 sider til – Arbeid – Microsoft​ Edge.png

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events