So I am trying to do something similar to this post over here: Scripted Field
The difference is, I am operating in Jira Cloud, where it appears that they are operating on Jira Server.
When attempting to duplicate their answer I am getting an issue with the importer. (So of course I removed them, and with some help adapted the code to be as follows:
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
import groovyx.net.http.RESTClient
def jql = "project = PROJ and reporter = '${issue.reporter.name}' and statusCategory NOT IN (Done, Canceled, Closed)"
// Make the REST API call to Jira Cloud
def restClient = new RESTClient('https://OURSITEURL/rest/api/3')
def response = restClient.get(
path: '/search',
query: [jql: jql]
)
// Parse the JSON response and get the total number of issues
def jsonResponse = new JsonSlurper().parseText(response.data)
def totalIssues = jsonResponse.total
return totalIssues
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 3: unable to resolve class groovyx.net.http.RESTClient
@ line 3, column 1.
import groovyx.net.http.RESTClient
^
1 error
at com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:50)
at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:33)
at com.adaptavist.sr.cloud.events.ScriptedFieldExecution.run(ScriptedFieldExecution.groovy:30)
at TestScriptedFieldExecution1_groovyProxy.run(Unknown Source)
Apologies if this is a simple question, I am somewhat unfamiliar with API coding.