Groovy - jql issue search with current week

Hi All,

Could you please suggest additionally how I can add "issue created within this week" parameter to below jql query (groovy script)?

Query query=builder.project().eq("DEMO").and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue()).and().customField(cf2.getIdAsLong()).eq(cf2Value.getValue()).buildQuery();

Please ask if you need more info.

4 answers

1 accepted

This widget could not be displayed.

I didn't tried but once you can check

Query query=builder.project().eq("DEMO").and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue()).and().customField(cf2.getIdAsLong()).eq(cf2Value.getValue()).and().created().gtEqFunc("startOfWeek").buildQuery();

you just go through the gtEqFunc(String funcName)

Yes.. it's worked. thanks :)

This widget could not be displayed.

createdAfter("-1w") is working, but want to find specifically from start of this week like, created >= startOfWeek() (in jql). Please suggest.

Any suggestions?

Getting below error while trying with,

Query query=builder.project().eq("DEMO").and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue()).and().customField(cf2.getIdAsLong()).eq(cf2Value.getValue()).and().createdAfter(startOfWeek()).buildQuery();

Error,

Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.startOfWeek() is applicable for argument types: () values: []
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
... 146 more
Caused by: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.startOfWeek() is applicable for argument types: () values: []
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.callGlobal(GroovyScriptEngineImpl.java:389)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.access$000(GroovyScriptEngineImpl.java:72)
at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl$2.invokeMethod(GroovyScriptEngineImpl.java:301)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:46)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:137)

This widget could not be displayed.

createdAfter("-7d") is working but need something like created >= -1w. Please suggest.

This widget could not be displayed.

See com.atlassian.jira.jql.builder.JqlClauseBuilder#addFunctionCondition.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 13 hours ago in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

66 views 0 8
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