I'm trying to implement quite a simple thing using Jira Automation: add a list of cloned issues keys to a comment in the epic issue, where all those cloned issues are getting linked to.
My automation has a branch with a JQL rule used to select related issues and iterate over them. Before entering that branch I'm adding a new comment to the trigger issue (which is that main epic issue) and then within the branch I'm cloning certain issues and link them to that epic issue, where the comment was added earlier in this automation, and would like to update that comment with a full list of issue keys for all the cloned issues.
I'm aware that this type of branches are running as separate processes and I will not be able to see "createdIssues" list outside of the branch. Hence I decided to try the solution with adding a generic comment first (before entering the branch) and then within that branch update that comment using its ID.
According to the logging initial comment is being added successfully, it's ID is being assigned to a variable, variable's value is present when inside the branch, "createdIssue" smart value works as expected within the branch, BUT when it comes to the Edit Comment action, where I use the "Smart Value" to refer to the comment ID to be edited, it produces the same "No comment to edit" error in the log despite of whatever I try to put there in the comment text (tried both dynamic and static text values there).
I tried googling for this "No comment to edit" error as well as searched for it here in the community and there were no matches at all.
Also I tried adding a "Re-fetch issue data" action inside that branch and before the Edit Comment action to make sure that the branch can "see" the last comment - same story, just getting "No comment to edit" error in the log and comment is not getting updated.
Here is that part of my automation:
Here are the parameters of certain actions from the automation above:
This is an example of an Edit Comment action with just a simple text "TEST" to illustrate that even that one is leading to this "No comment to edit" error:
This is an original Edit Comment action, where I was expecting the initial comment to be updated with the list of the keys of the cloned issues:
And here is what I see in the logs after running the automation (comment ID logged here is a valid one and it corresponds to that initial comment, which was added prior to entering the branch) :
Has anyone faced this type of issue and what could be alternative options to achieve the desired result in my case?
Thanks in advance for your help!
Hi @Anton Zubets -- Welcome to the Atlassian Community!
For a question like this, I recommend posting an image of the entire rule in one image. A browser addon (or app) for scrolling capture can help do that.
Next, based on what your initial post described:
I'm trying to implement quite a simple thing using Jira Automation: add a list of cloned issues keys to a comment in the epic issue, where all those cloned issues are getting linked to.
What problem is solved by adding the list of cloned issue keys to the trigger issue? Knowing that may help the community offer better suggestions.
Regardless, and without seeing the entire rule, there are problems in the rule section shown:
After adding the comment to what appears to be the trigger issue, the rule then creates a variable named lastCommentId to capture the id. But that is the last comment added from the time the rule triggered, and not from the last action. Please add a Re-fetch Issue action after adding the comment and before creating the variable to get the latest, last comment's id.
The branch on JQL is to a different issue than the trigger issue, and inside there is an action to edit a comment, referencing the saved variable...which is a comment id for the trigger issue's comments. The edit comment action is in the context of the "current issue", which in this case is the branched-to issue. I do not believe the action can arbitrarily access any comment as the REST API function does not support that.
Kind regards,
Bill
Hi @Bill Sheboy
Thanks for a swift response!
I was not adding the full automation screenshot simply because there is nothing there, which could cause such error.
After adding the comment to what appears to be the trigger issue, the rule then creates a variable named lastCommentId to capture the id. But that is the last comment added from the time the rule triggered, and not from the last action. Please add a Re-fetch Issue action after adding the comment and before creating the variable to get the latest, last comment's id.
I also thought so but it actually works like a charm without re-fetching :) I did quite a bunch of test runs while logging the value of this lastCommentId variable right after the Add Comment action and every time this variable was having an id of the newly added comment from that action right before the logging one.
I did some more experiments and also accidentally discovered exactly what you described above: when inside the branch any Add Comment actions are adding comments to the issue(s), which are being iterated through according to that FOR loop of the branch.
That's understandable and it's my bad to assume that Edit Comment action inside that branch would be able to "see" and edit a comment on the triggerIssue from the main execution path of this automation.
But the challenge is still there on how to achieve a desired behavior. Let me explain in text what kind of scenario I'm looking for:
Is it possible to add such a comment or not (due to the way branching works in Jira)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the additional details, and I believe you could use two rules to solve this:
First rule, to add the clones, and don't worry about the Epic comment yet:
Second rule, to check when done cloning, and comment on the original source Epic:
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.