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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.