Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy custom field from one ticket to new ticket in another JIRA instance.

Aravindi Amarasinghe
Contributor
August 16, 2018

Hi All, 

We have this function in JIRA service desk it communicate other JIRA instance and create ticket in that JIRA during the transition. 

The following code is a part of the script and it successfully create tickets in other JIRA as they are coping only system fields. 

In a new issue type there is a mandatory custom field called "Sub Priority" that should be filled to create the ticket. I tried several ways but none of them help me to copy the custom field to the new ticket. 

Can someone help me to insert custom field in this script? 

Thank you for your help. 

 

import com.atlassian.applinks.api.ApplicationLinkResponseHandler
import com.atlassian.applinks.api.ApplicationLinkRequest
import com.atlassian.applinks.api.ApplicationLinkService
import com.atlassian.applinks.api.ApplicationLink
import com.atlassian.applinks.api.application.jira.JiraApplicationType
import com.atlassian.applinks.api.CredentialsRequiredException
import com.onresolve.scriptrunner.runner.util.UserMessageUtil
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.sal.api.net.Request
import com.atlassian.sal.api.net.Response
import com.atlassian.sal.api.net.ResponseException
import com.atlassian.sal.api.net.ResponseHandler
import com.atlassian.jira.issue.comments.DefaultCommentManager
import com.atlassian.jira.issue.IssueManager
import groovy.json.JsonBuilder
import groovy.xml.MarkupBuilder
import groovy.json.JsonSlurper
import com.atlassian.jira.security.JiraAuthenticationContext
import com.atlassian.jira.util.json.JSONObject
import static com.atlassian.sal.api.net.Request.MethodType.POST


def body_req = [
fields: [
project: [
key: "ARC"
],
summary: issue.summary, //Take from the current ticket
description: issue.description, //Take from the current ticket
issuetype: [
name: "RFS"
]
]
]

1 answer

0 votes
Gezim Shehu [Communardo]
Community Champion
August 17, 2018

How are you trying to send the custom field?

You should do it by id (id of field in the other instance)

Suggest an answer

Log in or Sign up to answer