The Exalate team will be on holiday for the coming days - returning Jan 4
Enjoy & stay safe

Questions

 
1
0
-1

For an outging sync I have:


import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.bc.issue.IssueServiceimport com.atlassian.jira.issue.IssueInputParametersimport com.atlassian.jira.issue.search.SearchExceptionimport com.atlassian.jira.issue.search.SearchResultsimport com.atlassian.jira.issue.search.SearchProviderimport com.atlassian.jira.web.bean.PagerFilterimport com.atlassian.jira.security.JiraAuthenticationContextimport com.atlassian.jira.bc.issue.search.SearchService.ParseResultimport com.atlassian.jira.bc.issue.search.SearchServiceimport com.atlassian.jira.user.ApplicationUser
ApplicationUser automationUser = ComponentAccessor.getUserManager().getUserByKey("automation")
if (issue.customFields."Devices Affected".value){    SearchService searchService = ComponentAccessor.getComponentOfType(SearchService .class)    ParseResult parseResult = searchService.parseQuery(automationUser, "project = CMDB AND 'CMDB Hostname'=" + issue.customFields."Devices Affected".value)    int totalIssues = 0
    if (parseResult.isValid())    {      SearchResults results = searchService.search(automationUser, parseResult.getQuery(), PagerFilter.getUnlimitedFilter());      final List issues = results?.results      totalIssues = issues.size()
      if (totalIssues == 1)      {        replica.vctags = issues[0].getCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_22321"))      }    }}

TTrying to lookup and get data from other issues.


Which gives the Exalate error:


Incorrect usage of JIRA/lucene search API. You can only create/use: ManagedIndexSearcher inside a context (request or Jira-Thread-Local). C...


How do I solved that, I need data from [at least] one other issue added to the replica. Its code used often in Adaptavist Scriptrunner.



  1. Ariel Aguilar

    Hi Normann,

    You may find what you are looking for here:

    https://docs.idalko.com/exalate/x/yYKKAg

    The components script should have a section for you to search for issue data. Please check it out and let me know if you find it helpful.

    Kind regards,

    Ariel

CommentAdd your comment...