Salesforce to Jira Integration : for Description attribute : Illegal unquoted character has to be escaped using backslash

Hello,
I am doing POST call to Jira from Salesforce for Issue creation. Their is a description attibute, in which i need to pass line breaks (\n) . However, i cannot pass description with Line breaks , I get error : {“errorMessages”:[“Illegal unquoted character ((CTRL-CHAR, code 13)): has to be escaped using backslash to be included in string value\n at [Source: org.apache.catalina.connector.CoyoteInputStream@2173bded; line: 10, column: 42]”]}
Is their any way, in which i can pass line breaks in Description to Jira?

You have to make sure that the JSON payload contains not literal new-lines (code 13), but the string \n. Example:

  • Bad:
{"description": "foo
bar"}
  • Good:
{"description": "foo\nbar"}

How you do that depends on your programming language setup. For Javascript/Typescript it would be JSON.stringify()

Hello AndreasEbert,
Thank you for replying to me. I code in apex which is similar to Java. The description value which is sent is below

String str=‘Account Name: M C ASSEMBLY TEST INC In SFDC Case: 00292860 \n \n [Description]\n test**’;

The issue is created successfully, but the line breaks are not maintained when received in Jira description field. I want to maintain the line breaks when received in Jira. Is their any other way?

Ah, ok. I suggest you take a look at Jira’s text formatting help, especially the section Text breaks: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=breaks

1 Like

Thank you @AndreasEbert ~ This helps : )

1 Like

Hello @AndreasEbert This isnt a related issue, but could you please suggest a jira document for add attachment on Issue. All i have is the below url. Andi am facing an issue while add attachment function. Jira 9.4.8 Issue : REST POST to add attachment gives status 200 OK bu...