Forums

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

Notify assignee if no comment is made for 7 days

Keshav July 25, 2023

Hi.

I have already created an automation rule that will send a reminder to the assignee if a comment has not been added to the Jira issue since 7 days.

There are two scenarios a) and b)

a) Comment is present: When the last comment was added 7 days ago

b) Comment is not present: Jira Issue has no comments ever. And its been 7 days when the issue was moved to Sprint. What I have done here is when the issue moves to the Sprint, I set a custom field 10015  (Start Date) equal to that day when it was moved to Sprint in order to calculate the difference in days. 

The above rule works fine and sends email in both scenarios successfully, but I am not getting the expected result in cases, when a Jira Issue has sub-tasks. 

When the Jira issue has a sub-task, the developers comment on the individual sub-task and not the parent task. What I actually want is: Iterate through all Jira items in the opensprint(with or without sub-tasks), and send email reminder to assignee if none of the sub-tasks has been commented since last 7 days.

 

What is happening now: Based on my JQL, I iterate through all the items in the opensprint (only the parent issues) and if the parent issue has not been commented, then it sends email reminder. This works totally fine if I do not consider the sub-tasks logic.

If I expand my JQL (by checking sub-tasks as well), then each Jira issue (parent and sub-tasks) gets counted individually and do not give the expected result in case of Jira issue with sub-tasks. Suppose if I have 5 issues and each issue has 4 sub-tasks and condition of not commenting for 7 days gets satisfied, then there will be 20 email reminders instead of just 5 (which I actually want)

Note: I don't want to use Script Runner or any other add-ons in order to achieve the results because I am not sure whether in my Company that will be allowed or not.

Step1.pngCondition and Action 1.pngCondition and Action2.png

2 answers

0 votes
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.
July 26, 2023

Hi @Keshav 

With your addition of sub-tasks to this "send reminders" use case, one challenge is built-in JQL does not support returning both the parent issues and their subtasks with one query.

Your possible solution approaches depend on what outcome you want:

  1. send a reminder to the assignee for each individual issue
  2. send one reminder to each assignee, containing all of their issues

For case #1, use your original rule and JQL to only find the issues (not the subtasks).  Check the issue and send a notification.  Then branch over any subtasks to repeat the checks in a loop to send more notifications.  I believe this is what @Patricia Francezi suggested.

 

For case #2, this might be possible if you gather all the issues, and then walk them by distinct assignees in an advanced branch.  Disclosure: I have not tried this scenario, so you will need to experiment a bit.

  • remove the JQL from the scheduled trigger
  • use a lookup issues action with your original JQL to gather the keys of all of the issues
  • create a variable to save some JQL for future use; let's name that varIssuesJQL
key IN ( {{#lookupIssues}}{{key}},{{/}} )
OR parent IN ( {{#lookupIssues}}{{key}},{{/}} )
  • use that saved JQL to find all of the relevant issues with a second lookup issues action
  • advanced branch over the distinct assignees, {{lookupIssues.assignee.distinct}}
    • use a third lookup issues action, adding the loop variable to the saved JQL above

 

Kind regards,
Bill

Keshav July 27, 2023

Thanks @Bill Sheboy for the response. I am going with case #1. I tried to do what you and @Patricia Francezi suggested, but I am facing issues in them.

Below are the steps;

a) create global variable 'flag' and set it to 1

b) loop as many times as count of sub-tasks (say 4)

         if last comment < 5 mins, set 'flag' = 0 (will change to 7 days during actual implementation)

loop ends before step d)

d) if 'flag' = 1 (denotes no sub-task had a recent comment)- send email to assignee of parent issue

    else 'flag' = 0 (denotes one or other sub-tasks had a recent comment)- don't send email reminder

--------------------------------------------------------------------------------------

In log action, I see couple of issues

1. When using for loop, the execution of steps is not sequential

2. I loose the value of variable 'flag' when it comes out of loop even though it has been defined at the start.

Can you please help me with the steps?

--------------------------------------------------------------------

Screenshots

1.png2.png

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.
July 27, 2023

Oh...now I see what's happening: this is a branching and created variable effect.

---------

First thing, there is only a "create variable" and no "update variable".  More about why that is important in a minute.

Branches on one-and-only-one thing (e.g., branch on parent, branch on current issue, etc.) essentially are run in-line, as if the branch was not present.

All other branches (e.g. for sub-tasks, branch on JQL, etc.) are run in parallel and asynchronously.  There is no guarantee of when they will finish, up to the last step of the entire rule.  And...other than edits, what happens in the branch for each loop goes out of scope and vanishes.

---------

Putting these ideas together and looking at the rule image, you are trying to update the variable "flag" in the branch on many things, but that is impossible with the way branches work today.

When you want to gather information to decide something for multiple issues, it is better to gather the issues using the Lookup Issues action with JQL, and then treat them as a set.  ( For the special case of subtasks, I believe you could directly access them with {{issue.subtasks}} )

0 votes
Patricia Francezi
Community Champion
July 25, 2023

Hi @Keshav 

You may use branching to access the subtasks to the related tasks, and perform the actions / conditions you need on them.

Check if this doc helps you https://support.atlassian.com/cloud-automation/docs/branch-automation-rules-to-perform-actions-on-related-issues/#Branching-on-related-issues

Keshav July 25, 2023

Hi Patricia,

Thanks for the response. I tried using the URL provided, but I am stuck at this point in screenshot:

The UI asks me to enter JQL, but I am entering 'Advanced compare condition'. Do you know a matching JQL corresponding to one boxed in Green OR other option if possible can we use 'Advanced compare condition' instead of JQL?

Screenshot 2023-07-25 164700.pngScreenshot 2023-07-25 165142.png

 

Or do you have a simpler approach to achieve this?

Keshav July 26, 2023

Hi,

I did a small PoC and tried using branching to set a variable to 0 or 1 based on whether the last comment is <5 minutes or not. Looks like there is a BUG in branching as the steps do not get executed sequentially and gets executed in random order, leading to incorrect result. Screenshot below:

PS-109 - parent,

PS-110 (last comment < 5 minutes ago)  and PS-117 (last comment>5mins) - Children of PS-109

Another observation is: if there are more than 1 sub-task, then the even though 'flag' was set to 0 (inside IF condition), when it comes out of the loop, it looses its value and takes the value set initially (1 in my case). Its really confusing as it limits the use of using variables 

What I am trying to do (steps in screenshot)

a) create global variable 'flag' and set it to 1

b) Issue type = tasks (not sure if this is required or not, looks like we have to do this step before branching)

c) loop as many times as count of sub-tasks (say 4)

         if last comment < 5 mins (will change to 7 days when PoC done), set 'flag' = 0

d) if 'flag' = 1 (denotes no sub-task had a recent comment)- send email to assignee of parent issue, to update comment since its been more than 7 days without a comment.

    else 'flag' = 0 (denotes one or many sub-tasks had a recent comment)- don't send email reminder

 

1.png2.png

Suggest an answer

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

Atlassian Community Events