How would I write a query that would show all tickets worked on that week?

Jonathan Pisors (Alcority) December 21, 2022

We have multiple projects in both software and service. A user can have tickets in any of the software or service projects. I for example, have tickets in 5 different projects. 

I am looking for a way to query all of the tickets a current user worked on during the week. This can include the user as an assignee, as a commenter on a ticket that is not assigned to that user, or a ticket that the user logged time on via the time tracker. 

 

I tried using the following using scriptrunner enhanced search:

(

assignee = currentUser()

AND updated >= startOfWeek()

AND status not in (Backlog, Canceled)

)

OR

(

worklogAuthor = currentUser()

AND worklogDate >= startOfweek()

)

OR 

(

lastCommentedDate > startOfWeek()

AND commentedby = currentuser()

)

 

I ran into a problem where if anything was updated on the ticket, then it brought the ticket into the results. (if someone else updated a field then it would appear in my list of worked tickets)

I also had the total time logged on the ticket appearing as opposed to the total time logged that week. (If I worked 5 hours last week on it and only 2 hours this week, then I would only want 2 hours to appear in the results as opposed to 7 hours appearing.)

 

This filter/query will end up being used as part of a dashboard for reporting. 

We do have scriptrunner enhanced search available to utilize. 

 

If this is not possible with the out of the box jql and scriptrunner enhanced, we'd appreciate a comment stating that. If this can be done utilizing a different app, please state which one so we can take a look at it. Thanks for the help!

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 21, 2022

You can use the native Advance Search function updatedBy to search for issues updated by a specific user within a specified date range:

https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-functions/#Advancedsearchingfunctionsreference-updatedByupdatedBy--

Using OTB JQL you will not be able to get the results to display the time logged by only one user among multiple users on a ticket, nor only the time logged during a specified date range.

You might be able to create a ScriptRunner Scripted Field to get the information (time logged for current user). I have not tried to work out those details.

Otherwise there are third party apps that can be used to show all the time logged by an individual during a time period, and show the issues the time was logged against.  I used the following for that purpose. Note that the output displays in its own screen and at the time I used it you couldn't incorporate that into a Jira Dashboard.

https://marketplace.atlassian.com/apps/1219004/worklogs-time-tracking-and-reports?hosting=cloud&tab=overview

Jonathan Pisors (Alcority) December 27, 2022

Thanks! I'll take a look!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events