Forums

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

Automate spent time report

Chasovskikh Kirill
Contributor
January 23, 2024

Hello!

Is it possible to automate daily report of spent time to all tasks for a user and send them to slack?

2 answers

1 vote
Mary from Planyway
Atlassian Partner
January 23, 2024

Hi @Chasovskikh Kirill 

It's Mary from Planyway

Yes, in Jira, it is possible to automate the creation of a daily report of time spent on all tasks for a user and send this report to Slack. This automation can be achieved by integrating Jira with Slack and using Jira's automation tools. Here's a general approach:

  1. Jira and Slack Integration: First, ensure that Jira and Slack are integrated. This can be done through the Slack Marketplace where you can find apps that connect Jira with Slack.

  2. Use Jira's Automation Feature:

    • Jira offers a powerful automation engine that allows you to create custom rules. You can set up a rule to track time spent on tasks.
    • The automation rule can be configured to trigger at a specific time each day (e.g., end of the day).
    • The rule can collect data on the time logged by a specific user across all tasks for that day.
  3. Creating the Report:

    • The automation rule can be set to compile this data into a report format. This could involve summing up the total time spent, categorizing by task or project, etc.
  4. Sending the Report to Slack:

    • Once the report is generated, the automation rule can use the Jira-Slack integration to send this report to a designated Slack channel or directly to a user.
    • You can customize the message format and the Slack recipient(s) as needed.
  5. Additional Tools/Scripts:

    • Depending on your specific needs and the complexity of the report, you might also consider using additional tools or scripts. For instance, if Jira's built-in automation doesn't meet all your requirements, you could use Jira's API in conjunction with a scripting language like Python to fetch the necessary data and format it, then use the Slack API to send the report.
Chasovskikh Kirill
Contributor
January 24, 2024

Hi @Mary from Planyway 

> The automation rule can be set to compile this data into a report format. This could involve summing up the total time spent, categorizing by task or project, etc.

Could you help, how to compile with automation worklog report for one user for one day from different tasks? 

Mary from Planyway
Atlassian Partner
January 24, 2024

@Chasovskikh Kirill 

Hope it'll help:

  • Choose a trigger for your rule. Since you want a daily report, the trigger could be a "Scheduled" trigger, set to run at a specific time each day.
  • To gather worklogs for a specific user across different tasks, use JQL in the automation rule. Your JQL query might look something like this: worklogAuthor = currentUser() AND worklogDate >= startOfDay() AND worklogDate < endOfDay(). This query fetches all worklogs made by the current user during the current day.
  • Use the "Lookup issues" action with your JQL query to fetch the relevant tasks.

  • Next, add an action to process these issues. You might need to use a "Branch rule / related issues" action to iterate over each issue returned by the JQL query.

  • For each issue, extract the worklog details. This could involve summing up the time spent on each issue.

Chasovskikh Kirill
Contributor
January 25, 2024

@Mary from Planyway 

Thank you for the feedback!

To add values of worklog from all issues its possible to use 

{{#lookupIssues}}
* {{key}} {{worklog.timeSpent}}
{{/}}

But, do you know how to obtain values only for today's worklogs? Condition 

{{lookupIssues.worklog.started}} greater than startOfDay()

doesn't work.

Thank you in advance!

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.
January 25, 2024

Hi @Chasovskikh Kirill 

Please adjust the JQL for your Lookup Issues action to narrow to "today", as Maria suggested, or...

Try adding smart value, list filtering for the full lookup results: https://community.atlassian.com/t5/Automation-articles/Filtering-smart-value-lists/ba-p/1827588

Kind regards,
Bill

Chasovskikh Kirill
Contributor
January 25, 2024

Hi @Bill Sheboy  and thank you for the reply!

I understand how to get issues, where a user spent time today. 

worklogDate >= startOfDay() and worklogDate < startOfDay(1)

But the question is how to get from these issues worklogs only for current day? 

As I can see in this article — there is no conditional logic for date-fields.

Mary from Planyway
Atlassian Partner
January 25, 2024

@Chasovskikh Kirill 

While Jira's automation features are powerful, they have limitations in handling complex data processing tasks like filtering nested worklog entries by date. In such cases, a custom script using the Jira REST API provides more flexibility and control. However, there is a workaround using a combination of Jira automation and potentially a scripting solution.

  • Fetch Issues with Today's Worklogs:

    • Start with a JQL query in your automation rule to fetch issues with worklogs for the current day.
    • Example JQL: worklogDate >= startOfDay() AND worklogDate < endOfDay(). This should return issues that have worklogs added today.
  • Iterate Over Issues and Extract Worklogs:

    • Use the {{#lookupIssues}} smart value to iterate over the issues returned by your JQL query.
    • Within this loop, you can access each issue's worklog. However, the limitation here is filtering these worklogs to include only those with a started date of today.
  • Worklog Smart Value Limitation:

    • Jira automation might not directly support filtering worklog entries by their creation date within the rule itself. The {{issue.worklog}} smart value will list all worklogs for an issue, but not necessarily allow for filtering by date.
Like Bill Sheboy likes this
Chasovskikh Kirill
Contributor
January 26, 2024

Got it, thank you @Mary from Planyway !

Like Mary from Planyway likes this
1 vote
Trudy Claspill
Community Champion
January 23, 2024

Hello @Chasovskikh Kirill 

Jira does not natively provide reporting capabilities to get the time logged per day per user.

To get such a report you would need to consider adding a third party app.

Chasovskikh Kirill
Contributor
January 24, 2024

Hello @Trudy Claspill 

Perhaps, do you know any suitable plugins?

Trudy Claspill
Community Champion
January 24, 2024

There are a variety of plugins that provide a variety of functionality for reporting on time logged.

I don't know if any of them specifically include functionality for generating a report on a scheduling and sending it in any manner (slack, email, etc.). You would need to review the capabilities of the plugins to determine that.

Here is a search from the Atlassian Marketplace to help you get started.

https://marketplace.atlassian.com/search?hosting=cloud&product=jira&query=time%20report

Chasovskikh Kirill
Contributor
January 25, 2024

Thank you for the answer!

Yes, I've tried to find any plugins for time tracking, but the main problem is to find a plugin, that could send reports with webhooks.

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