JMWE - using callJira to add comment to issue

Ricardo.Gomes May 16, 2023

Hello there!

I'm trying to add a comment to the issue via API call using JMWE but I can't seem to get the content of the comment passed the right way.

The call follows the following format using POST:

{{ "/rest/api/3/issue/{issueIdOrKey}/comment" | callJira(verb="POST", body={ ... }}

 

It is what comes after "body={" that I'm struggling with as in how to send the content of my comment using the correct format.

Does anybody know how to do this?

Thank you!

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

Hi @Ricardo_Gomes 

are you sure you cannot use the existing Comment Issue(s) post function instead of a Nunjucks script for that?

Anyway, if you must use a Nunjucks script, then you should the V2 API, not the V3 API:

{{ "/rest/api/2/issue/:issueIdOrKey/comment" | callJira(
verb="POST",
params={issueIdOrKey:"TEST-1"},
body="Some comment with a *bold* word"
) }}
Ricardo.Gomes May 16, 2023

Thanks, @David Fischer !

I tried using that but it's not working for my use case, which involves the deletion of a comment provided during the transition which also gets copied to the issue I create after that transition (via JMWE Create Issue post-function with the option to copy the transition comment marked).

After the transition and the other issue is created, I have a post-function that deletes the comment from the original ticket (since the comment is actually intended for the newly created issue only). However, when I delete the comment from the source issue, the comment doesn't actually show on the newly created issue either.

Details with a video were added to this ticket: 

SUPPORT-93934

So I thought I set the value of a variable to the content of my comment and add it to the newly created issue via API. Not sure if that would work either, because it seems the comment is always somehow associated with the comment on the source issue somehow, and it always gets deleted too.

Thank you!

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

Hi @Ricardo_Gomes ,

I checked the support ticket, you need to put the Shared Action post-function and the Build-your-own post-function in a Sequence of post-functions post-function, so that the shared action runs before the build-your-own post function that deletes the comment on the current issue.

Ricardo.Gomes May 16, 2023

That worked! Thank you so much!

Been stuck on trying to find a solution for two days now :)

Much appreciated!

P.S. I'll close the support ticket.

Cheers!

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2023

I'm glad it worked.

Can you Accept the answer so it can benefit others in the future?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events