0

I am using a REST endpoint and here is my code: and here are some screenshots. The first screenshot shows the declaration of the condition and the denclaration of the Link: /rest/scriptrunner/latest/custom/callSubTaskCreator?issueId=${issue.id}. The second screenshot shows the declaration of the REST endpoint. I am specifying the link of a file in the script editor. Finally, the last screenshot shows the error page where I am redirected after clicking on the link.

enter image description here enter image description here

enter image description here

as you can see I am redirected to an error page after I click on the button. Anyone knows what is wrong?

package CreateMultipleSubtasks

import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate

import groovy.json.JsonBuilder

import groovy.transform.BaseScript

import com.atlassian.jira.issue.Issue;

import javax.ws.rs.core.MultivaluedMap

import javax.ws.rs.core.Response

import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.scriptrunner.runner.ScriptRunnerImpl

import com.atlassian.sal.api.ApplicationProperties

import com.atlassian.sal.api.UrlMode

import org.apache.log4j.Logger

import com.atlassian.jira.project.Project

import com.atlassian.jira.bc.project.component.ProjectComponent

import com.atlassian.jira.project.ProjectManager

@BaseScript CustomEndpointDelegate delegate

callSubTaskCreator(httpMethod: "GET", groups: ["jira-users"]) {

MultivaluedMap queryParams, String body ->

def log = Logger.getLogger("atlassian-jira.log")

log.warn("I AM HERE MOUNA 1"); 

ConfigurationCreateMultipleSubtasks conf = new ConfigurationCreateMultipleSubtasks()

def subTaskCreatorHashMap= conf.getSubTaskCreatorHashMap()

String itracCreatemultiplesubtasksProjectCategoriesURL = subTaskCreatorHashMap["itracCreatemultiplesubtasksProjectCategoriesURL"];

def user = ComponentAccessor.jiraAuthenticationContext?.loggedInUser

Issue issue = ComponentAccessor.getIssueManager().getIssueObject(queryParams.getFirst("issueId") as Long)

def itracCreatemultiplesubtasksProjectCategoriesURL2 = itracCreatemultiplesubtasksProjectCategoriesURL.replaceAll(":1:", issue.getKey())

def itracCreatemultiplesubtasksProjectCategoriesURL3 = itracCreatemultiplesubtasksProjectCategoriesURL2.replaceAll(":2:", user.getUsername())

Response.temporaryRedirect(URI.create(itracCreatemultiplesubtasksProjectCategoriesURL3)).build()

  

}

0 Answers0