Need help !! Jira automation to send email when team members logged less than 40 hours in a week
Asked by Anj R:

Hi,

I am trying to use Jira Automation to schedule and send an email to myself and my team with a list of team members who logged less than 40 hours in a week.

We log our time from Jira 'issue type' and I use worklogs to track the time every Friday and reach out to people who logged less than 40 hours in the week. I am looking to reduce this manual effort and automate sending an email to myself with the list.

Suppose I have below team members who logged time in different issues which I could retrieve using a query.

![LOG.png](/t5/image/serverpage/image-id/310927i63C23B0165646F4E/image-size/large?v=v2&px=999 "LOG.png")

Steps I followed to build the automation:

**STEP 1:** Used the trigger: When scheduled and added below jql query :

project = 'My projectname' and worklogDate \>= "2024/02/26" and worklogDate \<= "2024/03/01"

**Step 2:** Now I want to sum the total hours logged by each person and i want an automated email with a list like below for whoever logged less than 40 hours. I tried using below compare option in the 'if' statement

![log 2.png](/t5/image/serverpage/image-id/310928i45CA753F91F303DC/image-size/large?v=v2&px=999 "log 2.png")

**Step 3:** Then ,Send email

![log 3.png](/t5/image/serverpage/image-id/310929i9569150D09FC3B20/image-size/large?v=v2&px=999 "log 3.png")**Result I am expecting:**

Hello,

Below members logged less than 40 hours:

B

C

D

E

**Results I am getting:**

**4 separate emails** for each of the 4 members and only the account ids instead of B,C,D and E.


Answers:
author: Bill Sheboy
body: Hi [@Anj R](/t5/user/viewprofilepage/user-id/5447717) -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!

Until we see those...

When a scheduled trigger rule uses JQL, it runs for *each issue found*. It is not running only against the worklog entries. You instead want one email, listing the users with less than 40 hours logged.

If each person is only logging time to one issue, this scenario is possible If they log to multiple issues, it is not possible to send one email unless you hard-code each user's information to allow grouping results.

Assuming each person is only logging time to one issue...remove the JQL from the trigger, and instead use it with the Lookup Issues action. Then use smart value, list filtering instead of the condition, to return the results which a total of the time spent less than 40. Then the displayName attribute (rather than the accountId) may be included in your email.

Here are some additional references to help you modify your rule:

* <https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Lookup-issues>
* <https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588>
* <https://support.atlassian.com/cloud-automation/docs/jira-smart-values-users/#User-properties>

Kind regards,  
Bill


Tags: cloud