We normally allow project leads and certain users the ability to delete issues in Jira but recently we have had an outbreak of users deleting issues with time logged to them and that is a big issue so in the short term I have disabled the ability to delete cards for everyone.
Long term possible solution is:
The issue is, what if this is a Story and the Subtask has time?
So first thought was just use sigma timespent and that solves the issue, but after checking the automation possibilities and researching online I am finding that isn't possible.
I also tried to have it check the subtask for matches with time, but this also doesn't seem possible.
So the question would be, is there a way to have this automation also verify the Subtask doesn't have time as well before deleting?
Hello @Jason Krewson
Yes!
After the trigger add a Lookup Issue action to search for subtasks under the trigger issue where the subtask has Timespent
(If this is for a Team managed project, use Subtask instead of Sub-task.)
Then in your IF-Else block in the first IF where you are checking for Timespent on the issue, change the condition set to be "Any of" and add this smart value condition
If any subtasks with Timespent are found, then the size of of result set in Lookup Issues will be greater than 0.
So if either a subtask has Timespent or the main issue has Timespent, transition the main issue back to In Progress.
Thanks so much for the reply and help, I didn't think I would get a response so fast.
I have tested, below screenshot is the changes I made off your suggestion, and its still deleting the Story and Subtask when the Story has no time but each Subtask has 1 hour in it.
For testing I am doing 1 Story with no time that has 2 Subtasks with 1 hour each.
Maybe I did something incorrect?
This is Jira Cloud also, I forgot to mention this in my first post.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jason Krewson
It looks like you are missing a curly brace before triggerIssue in the JQL also - there should be two curly braces.
After fixing that, please test it again.
If it still does not work correctly then there may be something else wrong with the JQL.
Is the project to which the rule applies a Company Managed project or a Team Managed project? The subtask issue type name in the Lookup Issues JQL needs to be correct for that project type.
Can you confirm that the Lookup Issues JQL is finding the subtasks by substituting the issue key of your test issue where the JQL currently has {{triggerIssue.key}}, and then click the Validate Query link below and to the right.
If that says there are 0 issue then you should go to the View All Issues page and work out the JQL details to make sure it is correct for retrieving the subtasks you expect. The only difference between the JQL there and in the rule would be the use of the smart value for the trigger issue key.
If it still doesn't work, please share new images of the changes you've made and share the rule execution log output
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems to be this part that is causing the issue, moment I remove it I can validate the JQL query, if I leave it in I cannot click on validate query.
parent = {{triggerIssue.key}} and
This is a global rule but all our projects are company managed.
When I look through smart values, I cannot find {{triggerIssue.key}}.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jason Krewson
The Validate Query can't be used when you have a smart value in the query. That is why I asked you to substitute in the actual issue key as a test.
Can you confirm that the Lookup Issues JQL is finding the subtasks by substituting the issue key of your test issue where the JQL currently has {{triggerIssue.key}}, and then click the Validate Query link below and to the right.
Information about the smart value {{triggerIssue}} can be found here:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--triggerIssue--
It is a way to refer to the issue that triggered the rule, regardless of the current context of the rule at the moment of the reference. You can use {{triggerIssue}} anywhere that you could use {{issue}} to get at the values in the rule's trigger issue.
Did you go to the View All Issues page to validate that the JQL, with an actual issue key after parent= , returns the subtasks you would expect for the specified issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the information on this, it does return the correct subtasks when I swap it out with one of the parents.
parent = DELETE-20 and issuetype = Sub-task and Timespent is not empty
I tested again moving the parent Delete-20 to To Be Deleted status and it deleted the Story and the Subtasks.
We do use Tempo for time tracking, but this does add time to Timespent, that is why the automation works for just the Story (and JQL above for Subtasks), just couldn't figure it out for the Subtasks, but we are on the right track.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So for DELETE-20 there were Sub-tasks for which Timespent was not empty, and it was deleted anyhow by the rule?
Please share the rule execution audit log details from the rule execution where DELETE-20 and its subtasks were deleted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct and below is the log from when it deleted it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
According to the log the issue is not matching the conditions on the IF, so it moves on to the ELSE-IF which it does match and the issue gets deleted.
In the IF it looks like for the smart value you may have used {{lookupissues... with a lower case "i". It needs to be an upper case "I". If it is not upper case please make that change and test again.
If that does not resolve the issue, again please provide the log output and also please an image of the details of the IF conditions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep it was i not I, so I updated it to the below.
{{lookupIssue.size|0}}
It ended up deleting it again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It also has to be plural, as in the example I provided.
{{lookupIssues.size|0}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good catch, I wont’t be able to update this and test again untill Thursday. Thanks for all your help on this, I will update again the moment I test and will let you know the results.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill I just got back from vacation, updated "{{lookupIssues.size|0}}" correctly, tested, and it worked!
I will do some more testing and let you know but this is great!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Testing went well, I tested every combination I could think of and it only deleted when there as no time in the Story and the subtask so its perfect.
Thanks again for all the help @Trudy Claspill
Below is what the final automation looks like.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.