Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-7031

Searching issue by custom field value through the API

XMLWordPrintable

    • Icon: Support Request Support Request
    • Resolution: Resolved Locally
    • Icon: High High
    • None
    • 3.2.1
    • Scheduled Tasks

      We plan to implement Jira in our company and for this we must prove that regular updates from our old issue tracking system are possible. For this I am writing a Jira service that should get all the issues that have changed in the old system and create/update the issues in Jira.

      For the update I have to check whether an issue has already been imported or not, thus I need to search a Jira issue by a custom field value. After studying your APIs for some hours the best I could come up with is the following code - which unfortuately tries to instatiate an interface

      private Issue jiraSearchByTicketId(Integer ticketId) {
      SearchRequest sr = new SearchRequest(true); // search without security checks
      CustomFieldParameter cfp;

      cfp.setCustomField(cfTicketID);
      cfp.addValue("" + ticketId);
      sr.addParameter(cfp);
      try

      { List issues = issueManager.execute(sr, adminUser); return (Issue) issues.get(0); }

      catch (SearchException e)

      { return null; }

      }

      Any ideas/hints whatsoever to do this?

              Unassigned Unassigned
              e9b04eaecb42 Marcel Müller
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: