Hello Automation Gurus,
I'm facing the following issue:
Using Webcall I try to pass the Issue Description (multi-line with lists, text formatting, etc.) but the values of the field returns HTML codes or simpley breaks the JSON.
If I only have one line in the Description, the call is executed.
At this point I'm not sure if it is an Automation issue or with the 3rd party.
Here are the bodies of the 3 different approach I'va tried so far:
Description Smart value (as HTML):
--
{"boardId":"650aad035f9a70ef36ed6978", "name":"{{issue.key}}", "description":"{{issueDescription}} ", "versionIds":["{{issue.fixVersions.id}}"], "virtualVersionIds":[], "columnId":"650aad035f9a700032ed696f", "synchronize":false, "synchronizeParams":{"name":true, "description":true, "startDate":true, "releaseDate":true}, "startDate":"{{now.jiraDate}}", "releaseDate":""}
Returns:
{message=Bad control character in string literal in JSON at position 126, stack=SyntaxError: Bad control character in string literal in JSON at position 126 at JSON.parse () at parse (/home/node/app/server/node_modules/body-parser/lib/types/json.js:92:19) at /home/node/app/server/node_modules/body-parser/lib/read.js:128:18 at AsyncResource.runInAsyncScope (node:async_hooks:206:9) at invokeCallback (/home/node/app/server/node_modules/raw-body/index.js:238:16) at done (/home/node/app/server/node_modules/raw-body/index.js:227:7) at IncomingMessage.onEnd (/home/node/app/server/node_modules/raw-body/index.js:287:7) at IncomingMessage.emit (node:events:519:28) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)}
--
Description as text:
--
{"boardId":"650aad035f9a70ef36ed6978", "name":"{{issue.key}}", "description":"{{issue.description.text}}", "versionIds":["{{issue.fixVersions.id}}"], "virtualVersionIds":[], "columnId":"650aad035f9a700032ed696f", "synchronize":false, "synchronizeParams":{"name":true, "description":true, "startDate":true, "releaseDate":true}, "startDate":"{{now.jiraDate}}", "releaseDate":""}
Returns:
{message=Bad control character in string literal in JSON at position 119, stack=SyntaxError: Bad control character in string literal in JSON at position 119 at JSON.parse () at parse (/home/node/app/server/node_modules/body-parser/lib/types/json.js:92:19) at /home/node/app/server/node_modules/body-parser/lib/read.js:128:18 at AsyncResource.runInAsyncScope (node:async_hooks:206:9) at invokeCallback (/home/node/app/server/node_modules/raw-body/index.js:238:16) at done (/home/node/app/server/node_modules/raw-body/index.js:227:7) at IncomingMessage.onEnd (/home/node/app/server/node_modules/raw-body/index.js:287:7) at IncomingMessage.emit (node:events:519:28) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)}
--
Description field:
--
{"boardId":"650aad035f9a70ef36ed6978", "name":"{{issue.key}}", "description":"{{issue.description}}", "versionIds":["{{issue.fixVersions.id}}"], "virtualVersionIds":[], "columnId":"650aad035f9a700032ed696f", "synchronize":false, "synchronizeParams":{"name":true, "description":true, "startDate":true, "releaseDate":true}, "startDate":"{{now.jiraDate}}", "releaseDate":""}
Returns:
{message=Bad control character in string literal in JSON at position 120, stack=SyntaxError: Bad control character in string literal in JSON at position 120 at JSON.parse () at parse (/home/node/app/server/node_modules/body-parser/lib/types/json.js:92:19) at /home/node/app/server/node_modules/body-parser/lib/read.js:128:18 at AsyncResource.runInAsyncScope (node:async_hooks:206:9) at invokeCallback (/home/node/app/server/node_modules/raw-body/index.js:238:16) at done (/home/node/app/server/node_modules/raw-body/index.js:227:7) at IncomingMessage.onEnd (/home/node/app/server/node_modules/raw-body/index.js:287:7) at IncomingMessage.emit (node:events:519:28) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)}
---
Here is a screenshot about the rule:
What I have tried:
* changed the field renderer to text instead of wiki markup
* tried to store the Description in variables (as text or html)
* use single line in description: that worked but it is unreal for a description to have only one line.
Any suggestion on how to proceed? Or help identifying if it is an issue with Automation or with the 3rd party plugin?
Have a nice day!
{{issue.description.html.asJsonString}}
Did the trick for us to keep the formatting.
First thing, to avoid potential rule errors with smart value collisions, I recommend always adding a prefix to variable names, such as varIssueDescription rather than issueDescription.
What does the audit log show when you run your rule? (I recommend writing those diagnostic messages to the log rather than adding comments to the issue.)
Next, have you tried using the asJsonString function to include the description field in the message: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/#asJsonString
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
thanks for your suggestion.
I tried your approach and got this:
TEST Package creation
second line
- list
COLOR
produces:
TEST Package creation\n\nsecond line\n\n* list\n\nCOLOR
And this is what I got for response:
{message=Expected ',' or '}' after property value in JSON at position 99, stack=SyntaxError: Expected ',' or '}' after property value in JSON at position 99 at JSON.parse (<anonymous>) at parse (/home/node/app/server/node_modules/body-parser/lib/types/json.js:92:19) at /home/node/app/server/node_modules/body-parser/lib/read.js:128:18 at AsyncResource.runInAsyncScope (node:async_hooks:206:9) at invokeCallback (/home/node/app/server/node_modules/raw-body/index.js:238:16) at done (/home/node/app/server/node_modules/raw-body/index.js:227:7) at IncomingMessage.onEnd (/home/node/app/server/node_modules/raw-body/index.js:287:7) at IncomingMessage.emit (node:events:519:28) at endReadableNT (node:internal/streams/readable:1696:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)}
At this point I need to contact Atlassian to let them have a look into this as I think there is something wrong with escaping special characters.
Anyway, thanks for yor reply :)
Regards,
Csaba
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Those two do not appear to be related as the text written to the log is not 99 characters long...unless you are embedding in within a JSON expression.
Perhaps posting images your current, complete rule and an image of the audit log details for the rule execution will provide context.
Until then...
I recommend simplifying to test this piece by piece:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
this is my rule:
This is from the logs:
Here is the result:
Let me know what you think.
Regards,
Csaba
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for that information, @Csaba Vertessy
Where are you viewing that result for the "Description" after the second API call?
Does the markdown in that other system match the color syntax the Jira Description field is using: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=texteffects
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy , we were able to keep the expected formatting using
{{issue.description.html.asJsonString}}
Thanks for your suggestion!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.