I need help.
I already have the pendency creation script through the rest api... my problem is that I use another pending issue as a basis for field information (I copy the fields from this parent pending issue to the new pending issue created via api)...
From what I've noticed, if the parent issue description field has a line break, the issue is not created via the api.
How can I make it so that during the creation of the problem by the rest api the description field (even with a line break) is accepted in the execution and the problem is created.
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor .getCustomFieldManager()
def projectManager = ComponentAccessor .getProjectManager()
def baseurl = com.atlassian.jira.component.ComponentAccessor .getApplicationProperties().getString( "jira.baseurl" )
def Project_Key = ""
def atom_team_value = issue.getCustomFieldValue(customFieldManager.getCustomFieldObject( "customfield_11912" )) as List
def IssueType_Name ="Task" //issue.getIssueType().name
def channel_value = "Cross" //issue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10500"))
def summary_value = issue.getSummary()
def description_value = issue.getDescription()
def priority_value = issue.getPriority().getId()
Project_Key = "ATT"
def authString = "USER:PASS" .getBytes().encodeBase64().toString()
def body_req = """{
"campos":{
"projeto ":{ "chave" : "${ Project_Key }"}
, "issuetype":{ "name" : " ${ IssueType_Name } "}
, "summary":" ${ summary_value } "
, "description": "${description_value}"
, "customfield_10500": {"value" : " ${ channel_value } "}
, "priority":{ "id" : " ${ priority_value } "}
},
"update":{
"issuelinks":[
{
"add":{
"type":{
"name ":"Orquestrador",
"inward":"Atividade",
"outward":"Orquestrador"
},
"outwardIssue":{ "key":" ${ issue.key } " }
}
}
]
}
}"""
def connection = new URL ( " ${ baseurl } /rest/api/2/issue/" ).openConnection() as HttpURLConnection
connection.setRequestMethod( "POST" )
connection.setRequestProperty( "Autorização " , "Basic ${ authString } " )
connection.doOutput = true
connection.setRequestProperty( "Content-Type" , "application/json;charset=UTF-8" )
connection.getOutputStream().write(body_req.getBytes( "UTF-8" ))
connection.connect()
def postRC = connection.getResponseCode();
println (postRC);
if (postRC.equals( 200 )) {
println (connection.getInputStream().getText());
}