How to add comment of issue during the isssue transition from one state to another. Eg: in progress to resolved. For issue transition i am using below rest url .But I am unable to add comment on it.
/rest/api/2/issue/{issueIdOrKey}/transitions
@jay, hey.
The question has been answered here https://community.atlassian.com/t5/Jira-questions/add-a-comment-while-changing-issue-status-by-REST/qaq-p/590930
Cheers,Pears.
Hi @jay , if you want the same comment added to the Jira Issues after the transition is complete, I would recommend creating a Jira Automation routine to handle this.
You can do this in two ways, either on a per-project basis, or as a global rule on the entire Cloud site. I would recommend starting on a per-project basis and getting help from your organization's administrators to elevate this to a global rule if that's deemed necessary.
The rule should look something like below.
Trigger: Issue Transitioned
Action: Comment on Issue
This rule should apply to individual issues as they transition from one status to another in your chosen project. As always, I would recommend testing this in a test environment before creating it in your Live Production environment.
Great option if comment details need to be provided as part of the REST request.
Thanks @Pears Whims it worked. I have a small question to you. Now I am able to save comment on the issue transition. In my case it is from 'in-progress' to 'resolved'. Is there any way to find the exact comment which was saved during this transition. Because the comment which saved during transition also saved as a normal comment. So is there any way to find whether it is a comment added during transition time.
thank you @Robert DaSilva
I will check this and update you. I have a small question to you. Now I am able to save comment on the issue transition. In my case it is from 'in-progress' to 'resolved'. Is there any way to find the exact comment which was saved during this transition. Because the comment which saved during transition also saved as a normal comment. So is there any way to find whether it is a comment added during transition time.
@jay If I recall, the comment will be added by the "Automation for Jira" user, but you are also welcome to add a specific string of text to the comment itself to indicate it was added via a transition.
Something like:
Issue transitioned automatically from In Progress to Resolved.Comment added by automation.
Issue transitioned automatically from In Progress to Resolved.
Comment added by automation.
Now I added the comment using the REST API only not using the automation. Now you suggest to add the indication string in the comment body right? But other than that is there any solution. Because we need to preserve the exact comment saved by the user. Is there any label or tag to add the string.
Hey @jay
Glad it did work!
User Interface Solution - Activity Tabs
In the Activity tab, you may find transitions and comments displayed together.
Mind there might be a pitfall with this approach: Jira may group actions that occur close together in the activity stream, making it difficult to isolate comments added during a transition. They might appear bundled with other actions.
API Solution - REST
If you’re looking for a more API-focused approach, you can use the Jira REST API to retrieve the current status of an issue. This might assist in tracking transitions:
/rest/api/2/issue/{issueIdOrKey}/?fields=status
Beware this might have similar issue as with UI if Jira decides to aggregate actions.
Special Cases
In case You have those apps as Jira Misc Workflow Extensions (JMWE) they introduce special Transitions tabs that display detailed transition history.
Previously Jira Cloud UI also had Transition tab, yet this UI may not be longer available. Sharing this just if some dark feature flags can activate this. https://community.atlassian.com/t5/Jira-questions/JIRA-Issue-Transition-view/qaq-p/1026872
Let me please know if this helps.
Pears.
It looks like you're new here. Sign in or register to get started.