Accessing JIRA issue object in REST endpoint

I have the following code for a REST Endpoint

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.json.JsonBuilder
import groovy.transform.BaseScript

import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

@BaseScript CustomEndpointDelegate delegate

tempoWorkType(httpMethod: "GET") { MultivaluedMap queryParams, String body ->

    def callbackFn = queryParams.getFirst("callback")
    def issuekey = queryParams.getFirst("issueKey")
    
    
    ComponentManager componentManager = ComponentManager.instance
    IssueManager issueManager = componentManager.getIssueManager()
    MutableIssue issue = issueManager.getIssueByCurrentKey(issuekey.toString())
   CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()

I get an error 'Cannot find matching method' for the lines in bold above. Can someone let me know what I am doing wrong?

thanks

vidula
   

2 answers

What version of jira is this?

Hi Vidula,

Have you tried adding in the two following import statements in order to import the Issue Manager and CustomFieldManager.

  1. import com.atlassian.jira.issue.IssueManager;
  2. import com.atlassian.jira.issue.CustomFieldManager;

Thanks

Kristian

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

3,645 views 6 6
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you