We have a JQL workflow validator where a user can write a JQL statement. On the transition, the validator will check if current issue satisfies the JQL statement. if yes, continue; if not, alert.
We use SearchService to run the JQL in our JAVA code. here's a snippet:
It works totally fine except for the following case:
final SearchResults results = searchService.search(ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser(),
jqlQuery, PagerFilter.getUnlimitedFilter());
List<Issue> issues = results.getIssues();
We have a JQL validator whose JQL statement is"Project Lead is not Empty" for transition from TODO to In Progress. And there's an JIRA issue where the Project Lead is unassigned. So if we move workflow from TODO to In Progress, it should show alert and it does.
However, this time, we add a transition screen that contains the field "Project Lead" for the aboved tranisition and keep the Project Lead unassigned for that issue. When we move from TODO to In Progress, the tranisition screen pops up, and we assign Project Lead to be "admin". Then after hiting the "Start Progress" button, alert shows up and transition cannot be done.

Inside the JAVA code for the validator, we can get the issue and the value for "Project Lead" for that issue is "admin".
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
Collection<CustomField> cf = customFieldManager.getCustomFieldObjectsByName("Project Lead");
Object value = jIssue.getCustomFieldValue(cf.iterator().next());
Our theory is that SearchService only do the JQL query agaist the database. On the transition screen, although we assign "admin" to the "Project Lead", the new value is only in memory/cache, but not in database.
Our question is if there is a way to do JQL query agaist the memory by using SerchService or anything else.