Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

"No comment to edit" error in the Edit Comment action called inside a branch

Anton Zubets March 27, 2024

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:

image.png

Here are the parameters of certain actions from the automation above:

image.png

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:

image.png

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:

image.png

 

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) :

image.png

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!

1 answer

0 votes
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

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

Anton Zubets March 27, 2024

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:

  • This automation will be triggered manually by the user for any issue with the issue type "Epic" in a particular project.
  • After being triggered this automation is iterating through a list of issues linked to a predefined "epic" issue (let's call it a "template epic") and based on some criteria selects relevant "template" issues within that "template epic", clones each of them and links them to the triggerIssue of this automation (the original "Epic" issue, where the user triggered the automation)
  • I would like to add a comment to the triggerIssue to specify there that the automation was executed successfully and put there a list of all the cloned issues, which were added to this epic issue as the result of this run of the automation

Is it possible to add such a comment or not (due to the way branching works in Jira)?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2024

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:

  • trigger: manual
  • condition: issue type is epic
  • action: lookup issues with JQL, to identify the issues which will be cloned; the sole purpose of this action is to identify the total count of cloned issues with {{lookupIssues.size}}
  • ...do what is needed to clone the issues, and...
    • I am assuming there is something unique about this set of issues
    • In one of the fields of the clone, store the total count of cloned issues.  This could be a comment, added to the Description, entity property, etc.

 

Second rule, to check when done cloning, and comment on the original source Epic:

  • trigger: issue created
  • action: re-fetch issue
  • condition: issue type is not epic
  • related issues condition: has a parent
  • branch: identify and branch to the original source Epic
    • action: lookup issues with JQL to identify and sibling, newly cloned issues
    • smart value condition: compare the found issues {{lookupIssues.size|0}} to the count stored in the trigger issue, only proceeding when they match.  That indicates the last issue clone is completed.
    • action: add the comment to the Epic, using the keys from the lookup:
      • {{lookupIssues}}{{key}}{{^last}}, {{/}}{{/}}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events