I am programming a service within a plugin. It is a service that is programmed in the administration for automatic execution. I need to do JQL queries from it, but 0 records are always retrieved.
If the same query is executed within another action, it does return results. From the service, the AO query and the retrieval of data from objects such as the issue, the project, the history, ... work well, but not the JQL queries.
Any idea to be able to carry out that query from here?
public class UpdateDaysInsStatusService extends AbstractService{
@Override
public ObjectConfiguration getObjectConfiguration() throws ObjectConfigurationException {
return getObjectConfiguration("UpdateDays", "services/updateDays.xml", null);
}
@Override
public void run() {
pruebajql("Backlog");
}
private void pruebajql (String estado) {
SearchService searchService = ComponentAccessor.getComponent(SearchService.class);
JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();
builder.where().project("TKB").and().status(estado);
Query query = builder.buildQuery();
SearchResults<Issue> results;
try {
results = searchService.search(user, query, PagerFilter.getUnlimitedFilter());
System.out.println(" filas encontradas: " + results.getResults().size());
} catch (SearchException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Hi Pablo,
Welcome to community!
I believe when working with this part of Jira you want to use SQL not JQL. JQL is for the graphical interface, not scripting, the database or the API.
Best,
Clark
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.