This article is a continuation of Why flagging an issue is so cool?
Now, we are going to build a solution to emulate the functionality of adding a flag along with a comment from the issue detail view.
For doing so, we are going to use just Jira Software Cloud native features.
Please, note this solution is just a workaround to JSWCLOUD-17127 that needs to be set at the workflow level, so it is more an exercise than an actual recommendation.
Ideally, this feature will be developed by Atlassian soon, leaving this solution obsolete.
A Jira Administrator will need to configure the following elements:
The workflow(s) used by the issue type(s) of the project(s) where you want to have this solution.
Create a new screen named Comment Transition Screen.
You don't need to add any fields to this screen, since we are using it just for adding a comment during a transition.
Create a global looping transition named Add flag:
Set the Comment Transition Screen.
Now you will need to refresh the your browser to avoid finding a dead link on trying to set post-functions or conditions.
Add a condition to the transition of type Value Field:
Set the following parameters in the condition:
Basicly, this condition says the transition should only be available for unflagged issues.
Now, set an additional Value Field Condition, but this time with these parameters:
In other words, the transition will only available for unresolved issues, since a completed issue cannot be blocked.
Now, add a post-function of type Update Issue Custom Field:
And set it the following parameters:
This function will add a flag to the issue.
Add a second post-function of type Update Issue Custom Field, but this time with the following parameters:
In this case, Disposition is a custom field of type Labels. You can reuse any other custom field of type Labels or even using a different type of field. We are adding a label to trigger the Automation Rule below.
Finally, you just have to configure an Automation Rule this way:
This rule is triggered whenever a new comment is added to the issue.
A condition checks that the Disposition custom field contains the flag-comment label. If that is the case, the rule continues being executed. Otherwise, it stops without further effects.
The Edit issue fields action removes the flag-comment label that we added to our Disposition custom field, therefore removing the mark we used to tell this Automation Rule should be executed.
A new condition now checks that the comment being added does not already contain the flag icon. This is just a convenient thing so that if you already added the flag icon to your comment during the transition, the rule does not have to edit the comment, which produces an additional notification.
Finally, if all conditions above were met, then the flag icon will be added at the begining of the comment.
So, the solution is ready to add a flag and a comment from the issue detail view.
Enter the issue detail view of an unflagged and unresolved issue that is using the workflow you configured and that belongs to a project where the Automation Rule were set.
On the top-right corner, next to the Status field, click on the Add flag button, which is the global looping transition you set in the workflow:
The Comment Transition Screen will be shown so that you can comment why this issue is blocked:
And the issue will be flagged:
And the comment will have a flag at the begining:
And that's all for now.
Thanks for reading!
Ignacio Pulgar
Atlassian Certified Jira Admin
Vorwerk
Madrid (Spain)
177 accepted answers
7 comments