I have a Jira Service Management automation rule that was working as expected until a user filled out a form with special characters in the data.
I'm taking a new ticket from a service project and copying some data to a new Trello card.
The webhook action's request body looks like this:
{
"name": "{{issue.summary}}", "desc": "**Name:** {{issue.summary}}\n\n**Job Title:** {{issue.Job title}}\n\n**Team:** {{issue.New team}}\n\n**Manager**: {{issue.Manager.displayName}}\n\n**Role Type**: {{issue.Employment type}}\n\n**Start Date**: {{issue.Start date.fullDate}}\n\n**Desired Office Location:** {{issue.Employee location}}\n\n**Machine Type:** {{issue.Machine Type}}\n\n**Tech Needs:** {{issue.Tech Needs}}\n\n**Additional Comments:** {{issue.description.replace("\n"," \\n")}}\n\n**Attachments:**\n\n{{#triggerIssue.attachment}}\n\n* {{filename}}: {{content}}{{/}}\n\n**Jira Ticket:** {{triggerIssue.url}}", "idList": "MyListID", "idMembers": "member1,member2", "idCardSource""MySourceCard", "keepFromSource": "checklists" }
The results are like this:
{ "name": ""firstname "nickname" lastname"", "desc": "**Name:** "firstname "nickname" lastname"\n\n**Job Title:** job role\n\n**Team:** Client Services\n\n**Manager**: manager name\n\n**Role Type**: Full Time\n\n**Start Date**: full date\n\n**Desired Office Location:** Remote\n\n**Machine Type:** computer type\n\n**Tech Needs:** \n\n**Additional Comments:** Some comments \n \nEmail: email link \nPhone: phone link \n \nMorecomments. \n\n**Attachments:**\n\n\n\n**Jira Ticket:** MyJiraURL", "idList": "MyListID", "idMembers": "member1,member2", "idCardSource": "MySourceCard", "keepFromSource": "checklists" }
I've tried using the .asJsonString function to help with escaping the double quotes, but with no luck. JSON formatters I've tried point to this as the potential issue: `{{issue.description.replace("\n"," \\n")}}'
Any ideas?
Looks like I was able to resolve this by using the jsonEncode() function. I changed the body to use that function with the {{issue.summary}} smart values.
{
"name": "{{issue.summary.jsonEncode}}",
"desc": "**Name:** {{issue.summary.jsonEncode}}\n\n**Job Title:** {{issue.Job title}}\n\n**Team:** {{issue.New team}}\n\n**Manager**: {{issue.Manager.displayName}}\n\n**Role Type**: {{issue.Employment type}}\n\n**Start Date**: {{issue.Start date.fullDate}}\n\n**Desired Office Location:** {{issue.Employee location}}\n\n**Machine Type:** {{issue.Machine Type}}\n\n**Tech Needs:** {{issue.Tech Needs}}\n\n**Additional Comments:** {{issue.description.replace("\n"," \\n")}}\n\n**Attachments:**\n\n{{#triggerIssue.attachment}}\n\n* {{filename}}: {{content}}{{/}}\n\n**Jira Ticket:** {{triggerIssue.url}}",
"idList": "650c55b9b4f9b73d31ec0748",
"idMembers": "60f8481fc43352750e5d35bc,57fbafefad9335e482ccb4d9",
"idCardSource": "650c55c82e5ac2e0d4bafeaf",
"keepFromSource": "checklists"
}
Journeys is a brand new feature in Jira Service Management that helps you streamline various processes in your organization that may cross multiple departments, such as employee onboarding or off-boarding that require action from different teams. ✨
Join the EAP →Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.