Jira Automation ? notify when count of individually assigned issues in the Backlog 'is less than'
Asked by Shaurya.Sisodia:

Greetings,

I am trying to create an automation that is scheduled to notify the Product Owner when the count of issues assigned to individuals in Jira Backlog goes below, let's say 2.

This is what I have tried so far.

I am using Advance Compare Condition.

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/263785i0B7739FAF04F2137/image-size/large?v=v2&px=999 "image.png")

Thanks in advance,

\~ s


Answers:
author: Trudy Claspill
body: Hello [@Shaurya.Sisodia](/t5/user/viewprofilepage/user-id/5246748)

{{lookupIssues.size}} works only when you have used the Lookup Issues action. It doesn't work for getting you the number of issues returned in a JQL that is part of a Schedule trigger.

Do you want to send one email per assignee, or do you want to send one email that lists all the assignees that have less than the specified number of issues?

comments: author: Shaurya.Sisodia
body: Hi Trudy,

Thank you for your help.

I would be completely OK with one email per assignee.

I may have to rethink the Rule that I am applying. Could be something else instead of Scheduled. Thoughts?

Cheers,

Shaurya


author: Trudy Claspill
body: You can still run the rule on a schedule with the Schedule trigger. You just need to not enter a JQL in the trigger itself.

You can then use the Lookup Issues action to execute the same JQL you were using in the trigger **BUT** for just one user at a time. Then use a condition to check if the lookupIssues.size value is less than your cutoff, and then send the email.

Follow that with another Lookup Issues action to execute the JQL for another one of the users. Check the size of the results, and send the email.

Repeat for each Assignee.

![Screen Shot 2023-06-19 at 2.48.15 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/263958iA568F51DB31DC798/image-size/large?v=v2&px=999 "Screen Shot 2023-06-19 at 2.48.15 PM.png")

![Screen Shot 2023-06-19 at 2.50.32 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/263960i8476B06BEB7BD11F/image-size/large?v=v2&px=999 "Screen Shot 2023-06-19 at 2.50.32 PM.png")

![Screen Shot 2023-06-19 at 2.51.58 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/263961i5208317418118832/image-size/large?v=v2&px=999 "Screen Shot 2023-06-19 at 2.51.58 PM.png")

Add the step to send the email. Then copy/repeat steps 1, 2, \& 3 changing the JQL each time for a different Assignee.

![Screen Shot 2023-06-19 at 2.53.04 PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/263962i6D90F7AFCF9EEE86/image-size/large?v=v2&px=999 "Screen Shot 2023-06-19 at 2.53.04 PM.png")


author: Shaurya.Sisodia
body: This worked - thanks Trudy!

Out of curiosity to your earlier option: Is there a way to send one email that lists all the Assignees that have less than the specified number of issues??

Thanks in advance,

Shaurya


author: Trudy Claspill
body: I believe that there is but I haven't worked out the details.


author: Shaurya.Sisodia
body: Hello again [@Trudy Claspill](/t5/user/viewprofilepage/user-id/3569011), [@John Funk](/t5/user/viewprofilepage/user-id/7148)

I tried another approach to parse through the individuals in the team with less than x number of Issues in the Jira Backlog; this time using **Advanced branching** (*via* *New branc*h component) in the following manner:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/265655iA21F7413CEA236AE/image-size/large?v=v2&px=999 "image.png")

Within the *Advance branching* , have used Smart Value with *.distinct* as show in the picture to define a variable varAssignee

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/265656iA40AFCFEB6EECFF0/image-size/large?v=v2&px=999 "image.png")

And then within each of the distinct user, have applied a condition to send the email to the PO if the count of Issues for each individual is less than 2.

YET, I am not getting any result! The rule has execute as a "success" but only partially, i.e. without any action being performed from within the *Advance branching*. :( Please see below:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/265657i04C500D9AE18511D/image-size/large?v=v2&px=999 "image.png")

Can either/both of you please guide on what's that I am not configuring correctly and/or how to do it?

Thanks,

Shaurya


author: Trudy Claspill
body: The {{lookupIssues.size}} value is not being recalculated inside the branch based on the distinct Assignee value. It is still reflecting the size of the result set from the original Lookup Issues action.

You could add another Lookup Issues action inside the branch to lookup issues based on the distinct Assignee. That will generate a new lookupIsssues result set for each distinct assignee. Insert the new Lookup Issue action inside the branch and before the condition where you check the size. Use the same JQL you used in the first Lookup Issues action, but change the Assignee comparison to use just the {{varAssignee}} variable.

![Screen Shot 2023-06-29 at 8.00.10 AM.png](https://community.atlassian.com/t5/image/serverpage/image-id/265853i4744E2438B5701F8/image-size/large?v=v2&px=999 "Screen Shot 2023-06-29 at 8.00.10 AM.png")


author: John Funk
body: Hi Shaurya - Welcome to the Atlassian Community!

Can you share the JQL you are using in the Scheduled part of the rule?

Also, what is not working?

comments: author: Shaurya.Sisodia
body: Hi John,

Thank you for your help.

I am basically focussing on Story issue type for selected individuals all belonging to a particular team (in this case "Evaluate" which is determined by what we have in the Component field of each issue) within our project on Jira:

issuetype in (Story) AND component in (Evaluate) AND assignee in (635ee908fc0cc7a600af9cdf, 63d0940169c7ae3958d19a6c, 6327bc7da84c7f79c38306bc, 712020:e04daca5-6a33-46a5-9943-70d120bc20e1, 63993209914b350865d20a3a, 5e4b505c3011ed0c8f8ac78f, 63155f13d8850343ef593d4b, 6294320d9c88e7006fb41ba0) AND status not in (Withdrawn, Done) AND Sprint is EMPTY ORDER BY assignee ASC

The above JQL has already been validated and does give me what I expect to see.

Is my 'is less than' comparison with a number value ("2") in the Advance Compare Condition the reason my Scheduled isn't working? Can I actually make such a comparison:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/263802iF75776722FC26738/image-size/large?v=v2&px=999 "image.png")

Cheers,

Shaurya


author: John Funk
body: Yes, that is your problem. You can only have one value in the First Value field - so just {{lookupIssue.size}}


Tags: automation

jira-cloud