Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-4410

Documentation update on the Execute a JQL Query

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: 6.0.2-p5
    • Fix Version/s: None
    • Component/s: Documentation
    • Labels:
      None
    • Critical Points:
      2.1

      Description

      The sample code in the Execute a JQL Query documentation only works in JIRA 7 API. So when users attempt to try the sample code in JIRA 8, they will get some syntax errors.

      It should be updated to have two sample codes for JIRA 7 and JIRA 8 versions.

      The sample code for JIRA 8 should be like this:

      import com.atlassian.jira.bc.issue.search.SearchService
      import com.atlassian.jira.component.ComponentAccessor
      import com.atlassian.jira.jql.parser.JqlQueryParser
      import com.atlassian.jira.web.bean.PagerFilter
      
      def searchService = ComponentAccessor.getComponent(SearchService)
      def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
      def queryParser = ComponentAccessor.getComponent(JqlQueryParser)
      def issueManager = ComponentAccessor.getIssueManager()
      
      def query = queryParser.parseQuery("project = JRA and assignee = currentUser()")
      def search = searchService.search(user, query, new PagerFilter())
      
      search.results.each { documentIssue ->
          log.debug(documentIssue.key)
      
          // if you need a mutable issue you can do:
          def issue = issueManager.getIssueObject(documentIssue.id)
      
          // do something to the issue...
          log.debug(issue.summary)
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jloong John Chin Loong
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: