Hi All,
Could you please help me on following,
1. How to add order by created date parameter (ORDER BY created ASC) to the below JQuery in my groovy script?
Query query=builder.project().eq("DEMO - IT FX QA").and().customField(10284).gtEqFunc("startOfWeek").and().customField(10284).ltEqFunc("endOfWeek")buildQuery()
2. Also, after querying above search getting many issue results, like JIRA-1, JIRA-2, JIRA-3 etc. Could you please suggest how I can assign these result to seperate string value? like STRING1, STRING2 etc
is, STRING1 = JIRA1, STRING2 = JIRA-2 like. Currrently I'm getting the result count by below steps,
Query query=builder.project().eq("DEMO - IT FX QA").and().customField(10284).gtEqFunc("startOfWeek").and().customField(10284).ltEqFunc("endOfWeek")buildQuery() SearchResults searchResults = searchProvider.search(query, authenticationContext.getLoggedInUser(), PagerFilter.getUnlimitedFilter()); List<Issue> searchIssues = searchResults.getIssues(); totalIssues = searchIssues.size();
Please help.
Many thanks.
> How to add order by created date parameter (ORDER BY created ASC) to the below JQuery in my groovy script?
builder.where().project("JRA").endWhere().orderBy().createdDate(SortOrder.ASC).buildQuery()
> Also, after querying above search getting many issue results, like JIRA-1, JIRA-2, JIRA-3 etc. Could you please suggest how I can assign these result to seperate string value? like STRING1, STRING2 etc
I don't understand what you're asking here.
To get all the keys you can do: searchIssues*.key
2. From the above query I'm getting many issue number as result (like, JIRA-1, JIRA-2, JIRA-3 etc), so just want to store these to seperate variables (like VAR1 = JIRA-1, VAR2=JIRA-2, VAR3=JIRA-3 etc). Currently by below script I'm storing search result total count to a variable "totalissues",
Query query=builder.project().eq("DEMO - IT FX QA").and().customField(10284).gtEqFunc("startOfWeek").and().customField(10284).ltEqFunc("endOfWeek")buildQuery() SearchResults searchResults = searchProvider.search(query, authenticationContext.getLoggedInUser(), PagerFilter.getUnlimitedFilter()); List<Issue> searchIssues = searchResults.getIssues(); totalIssues = searchIssues.size();
Please let me know how it can be possbile.
Hope the query is clear now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Caused by: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.jql.builder.DefaultJqlClauseBuilder.where() is applicable for argument types: () values: []
Possible solutions: every(), every(groovy.lang.Closure), endWhere(), voter(), grep(), grep(java.lang.Object)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response. :)
1. My actual query is,
Query query=builder.project().eq("DEMO - IT FX QA").and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue()).and().customField(cf2.getIdAsLong()).eq(cf2Value.getValue()).and().customField(cf3.getIdAsLong()).eq(cf3Value.getValue()).and().customField(10284).gtEqFunc("startOfWeek").and().customField(10284).ltEqFunc("endOfWeek").buildQuery()
It's working fine and want to sort by created date the search result so just modified the query by,
Query query=builder.where().project().eq("DEMO - IT FX QA").and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue()).and().customField(cf2.getIdAsLong()).eq(cf2Value.getValue()).and().customField(cf3.getIdAsLong()).eq(cf3Value.getValue()).and().customField(10284).gtEqFunc("startOfWeek").and().customField(10284).ltEqFunc("endOfWeek").endWhere().orderBy().createdDate(SortOrder.ASC).buildQuery()
but getting below error.. Could you please suggest what causing this error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You just need to break it down into chunks and see where it fails.
> Hope the query is clear now
It's not remotely clear. Are you saying you want to dynamically create a variable for every issue? Why? Or are you saying you want to put the results in a Map where the keys are the issue keys?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Used simple query to figure out the issue,
Query query=builder.project("DEMO - IT FX QA").buildQuery()
It's working, then tried with,
Query query=builder.project("DEMO - IT FX QA").orderBy().createdDate(SortOrder.ASC).buildQuery()
but getting below error,
Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.jql.builder.DefaultJqlClauseBuilder.orderBy() is applicable for argument types: () values: [] Possible solutions: every(), every(groovy.lang.Closure), or(), priority(), voter(), grep()
also, tried with,
Query query=builder.where().project("DEMO - IT FX QA").endWhere().orderBy().createdDate(SortOrder.ASC).buildQuery()
but almost same error,
Caused by: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.jql.builder.DefaultJqlClauseBuilder.where() is applicable for argument types: () values: [] Possible solutions: every(), every(groovy.lang.Closure), endWhere(), voter(), grep(), grep(java.lang.Object)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try using the project key, not name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> It's not remotely clear. Are you saying you want to dynamically create a variable for every issue? Why? Or are you saying you want to put the results in a Map where the keys are the issue keys?
Yes.. want to create variables dynamically based on the search result count and need to store these issue key to the new variables in created date order.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Project key also not working for me.
Query query=builder.where().project("ITFXQA").endWhere().orderBy().createdDate(SortOrder.ASC).buildQuery()
Error,
Caused by: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.jql.builder.DefaultJqlClauseBuilder.where() is applicable for argument types: () values: [] Possible solutions: every(), every(groovy.lang.Closure), endWhere(), voter(), grep(), grep(java.lang.Object)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below query praser method is working,
def jqlQueryParser = ComponentManager.getComponentInstanceOfType(JqlQueryParser.class) as JqlQueryParser def query = jqlQueryParser.parseQuery("project = "DEMO - IT FX QA" ORDER BY project ASC")
Could you please let me know how I can add ".and().customField(cf1.getIdAsLong()).eq(cf1Value.getValue())
" parameter to the quey praser?
This is nothing but checking a custom field value of the current issue in the query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried with orderBy().createdDate(SortOrder.ASC).buildQuery() but getting below error,
Caused by: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.jql.builder.DefaultJqlClauseBuilder.orderBy() is applicable for argument types: () values: []
Possible solutions: every(), every(groovy.lang.Closure), or(), priority(), voter(), grep()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any suggestions guys?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.