How to query issues with empty workLogged?

The query below works, but it doesn't include logged time for sub-tasks, so when there isn't logged time for issue but there are there is logged time for at least for one sub task, the issue is still the query result.  

issueFunction not in workLogged("after 2013/09/01 before 2020/09/30")

I would like the case when the time is logged to at least one sub task, the issue won't appear in the result set. Is it possible?

3 answers

1 accepted

You can write your own JQL function which extends workLogged() function that it additionally returns issues with empty logged time which at least one sub-task have logged time.

 

String jqlQuery = "issueFunction in workLogged(\"" + operand.getArgs().get(0) + "\")";
SearchService.ParseResult parseResult = searchService.parseQuery(user, jqlQuery);

if (parseResult.isValid()){
    Query query = parseResult.getQuery();
    try {
        SearchResults results = searchService.search(user, query, PagerFilter.getUnlimitedFilter());
        List<Issue> issues = results.getIssues();

        for (Issue issue: issues){
            literals.add(new QueryLiteral(operand, issue.getId()));

            if (issue.isSubTask()){
                literals.add(new QueryLiteral(operand, issue.getParentId()));
            }
        }

    } catch (SearchException e) {
        // Catch exception
    }
}

Hi Michal,

              When you use not in worklogged, why do you get Sub-tasks with logged time ?

0 votes

This is pretty tricky. Although I'm kind of fatigued at the moment so I might be missing something.

The problem is that you want to query on the worklog index, but you return results from the issue index. Perhaps you can use the above query with another query that uses childrenOf ("your jql") to find issues that have no log worked on the parent but does have work logged on the children.

 

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,801 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot