Is there a way to use the startofmonth() with the worklogged function[addon-com.onresolve.jira.groovy.groovyrunner]

when trying to use the worklogged function

issueFunction in workLogged( "after 2014-08-01", "before 2014-08-30" )

is there a way to use the startofmonth() and endofmonth() with it for e.g. like

issueFunction in workLogged( "after startofmonth()", "before endofmonth()" )

3 answers

1 accepted

Not sure who Downvoter is

But the workarounds which have been suggested have one flaw

1) it has to be a per person thing since you cannot use the group or role level

2) if an issue has a work log 2 months old and the person recently made a change to comment on it it would show up

3) the workaround can be implemented with jiras existing columns

updated > startofmonth() and updated < endOfMonth() and timespent is not EMPTY

True enough. I don't really have a better workaround, I would probably use a service to programatically update the query every month. You can log a ticket for those functions to start the time functions too...

I needed that function too. But as stated in documentation https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+JQL+Functions#ScriptedJQLFunctions-workLogged(worklogquery) you can use either date YYYY-MM-DD or date expressions e.g. w, d, h, m.

You can also try to sort issues if they have been resolved during the period but it's not very precise:

CHANGED after startOfMonth(-1) before endOfMonth(-1) AND issueFunction in workLogged("by assignee")

Apart from you got the syntax a bit wrong, why do you say it's not precise?

if an issue has a work log 2 months old and the person recently made a change to comment on it it would show up in that query which you dont want since the worklog is old

By "not very precise" I mean this function is good when you have worklogs only in one period but if you have a big tasks with several worklogs - you will get it both in current and previous periods. For example, if you have a task with worklogs on July 31 and August 1 - it will be shown both in searches for this month (using startOfMonth()) and previos one (using startOfMonth(-1))... Still for me that wasn't a big problem.

And Jamie thank you for this awesome plugin.

1 vote

Gulfam, unfortunately it's not possible.

Alexander - that seems like a good workaround, with a slight adjustment:

updated > startofmonth() and updated < endOfMonth() and issueFunction in workLogged("by admin")

Downvoter - what's wrong with that?

Yes, my syntax is wrong... It should be:

status changed to "Complete" after startOfMonth(-1) before endOfMonth(-1) AND originalEstimate != 0 AND issueFunction in WORKLOGGED("by user.name") AND issueFunction in aggregateExpression("Estimated", "originalestimate.sum()", "Work Logged", "timespent.sum()")

...and that will make a report if employee user.name have managed to meet original estimates on completed tasks last month.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

160 views 0 4
Read article

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