Hi guys,
We have a project in JSM in instance X that receives ticket openings through emails sent by customers. The body of the email can arrive with various types of formatting (bold text, paragraphs, tables, signature, links), we do not have a standard. Through Jira automation we want to take the data from the "Description" field and send a web request (API) to create a new ticket in the instance Y.
I am doing a GET and retrieving the response with the smart value {{webResponse.body.fields.description}}, but it does not return me in json format for me to do the POST (creation of the ticket in the other instance Y).
I'm getting this:
{version=1, type=doc, content=[{type=paragraph, content=[{type=text, text=.....}}
When I need this:
{
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type":.........}
Body Json
Error:
Does anyone have any other solution? I just need the automation to copy the description of the source ticket and by making the API call I can create a new ticket in another instance.
Have you tried to convert it to a JSON string using the asJsonString function?
Hi @Mikael Sandberg ,
Yes, I tried, but I don't get any return in the log when I use {{webResponse.body.fields.description.asJsonString}}
Is there something wrong in the syntax?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, the web response should already be a JSON format, based on the screenshot you included above it is coming back as a JSONStringify format. So that leads me to believe that when you are using it in the custom data field it is missing a character. I would recreated the data in a JSON parser to see what could be wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mikael Sandberg ,
Thanks, really the previous error was due to a syntax problem in the json. Now I get a new error, I believe that the automation is not understanding the format of the data I am inputting through the smart value.
He expects this format:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think that document format is only for Jira Software. Assuming you are using the JSM create customer request endpoint you would not need to define the document format if you look at the documentation for it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mikael Sandberg ,
After a few more attempts I came up with a solution, I would like to thank you for your support.
After a few more attempts I arrived at a solution, I would like to thank you for your help, it was important for me to succeed.
Basically, I created a variable converting the value of the description field to an string json and then used the variable to make the post. For some reason when I tried this the other time without the variable, I got an error on the request.
Now I will work on getting the attachments.
Thank you very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Marina Vital how did this work for you? I have the same problem, and when I assigned a variable to {{issue.description.asJsonString}} it just returns with the description in quotes, doesn't covert to the required Atlassian Document format?
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.