Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

UNABLE TO COPY A COMMENT FROM AN INSTANCE A TO AN INSTANCE B

Davy Evrard YORO September 6, 2024

Hello

I have two instances in production js.atlassion.net (jira software)  for the dev and jsm.atlassian.net (Jira service Management) for the supports.

I have made an app link betwen my two instances. This means that i can link tickets from the two different instances.

What i want to do now, is to be sure that comment made in js tickets copied in jsm tickets.

I saw that the only possible solution for this is to go through automation then rest api. But nothing appens

I share the steps of my config with you

1 - My automation on js

JS.PNG

2 - In send web request, i put this

Webhook URL* : https://jsm.atlassian.net/rest/api/3/issue/{{issue.key}}/comment

HTTP Method : POST

Webhook body : Custom data

Custom data : 

"body": { "content": [ { "content": [ { "text": "Commentaire ajouté sur le ticket : {{triggerIssue}}", "text": " Dernier commentaire : {{triggerissue.comments.last.body}}", "type": "text" } ], "type": "paragraph" } ], "type": "doc", "version": 1 }

Headers : Key : Authorization / Value : Basic API_TOKEN (generated in jsm)

1 answer

0 votes
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2024

Hi @Davy Evrard YORO ,

Your automation looks correct.

After the  web request is sent, be sure to check the 'Delay Further steps', add a log action step and print the Body and status of the web request sent.

This will help you identify if the comment is being added as expected.

Davy Evrard YORO September 9, 2024

So i add {webhookResponse.status}}

Sans titre.png

But, I don’t see any change in the logs

de.PNG

Davy Evrard YORO September 9, 2024

{{#debug}}{webhookResponse.status}}{{/}}

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2024

Add this syntax {{webResponse.status}} and retry the execution.

Davy Evrard YORO September 9, 2024

Still nothing in the logs. It’s weird.

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2024

Can u share a snapshot of your web request action?

Davy Evrard YORO September 9, 2024

WR1.pngWR2.png

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 9, 2024

I would suggest making 2 changes

Firstly, check the second box as well so that the flow proceeds even without 200 response, this is for testing sake, and can be unchecked once you're confident the automation works fine.

Next I would Try using the Validate option, with one  of the issue keys whose comment you're trying to copy. This will give you instant feedback if something is going wrong.

Just to get better clarity for the audit logs would it be possible to share the output in English please?

Like Davy Evrard YORO likes this
Davy Evrard YORO September 10, 2024

Got this error when using the validate option :

{
  "errorMessages": [
    "There was an error parsing JSON. Check that your request body is valid."
  ]
}
Davy Evrard YORO September 10, 2024

My request body

 

{
"body": {
"content": [
{
"content": [
{
"text": "Comment added on ticket {{triggerIssue}}: {{triggerissue.comments.last.body}}",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "doc",
"version": 1
},
}
Davy Evrard YORO September 10, 2024

I solved the last error message by removing the coma here

 

WR2.png

 

Now i got an other error message related to permission:

{
  "errorMessages": [
    "Issue does not exist or you do not have permission to see it."
  ],
  "errors": {}
}

 

I thought that the fact of having created the ticket myself gave me the necessary rights. But it seems that to use the api I must have full jira system administrator rights?

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 10, 2024

Hi @Davy Evrard YORO 

Use the Jira permission helper with the issue that you're trying to add a comment, that should help you find the root cause for the error.

Also, are you creating a new issue in the same automation? If yes, then you'll need to add the refetch issue data Action to get the new ticket details.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events