This workaround aims to assist Jira Software (JSW) and Jira Work Management (JWM) projects that require communication with Jira Service Management (JSM) projects, which involves utilizing the Automation for Jira (A4J) feature to copy comments made between these projects.
At the moment, there are certain limitations in how the communication is made between JSM tickets and JSW or JWM tickets since JSM is primarily designed for customer interaction.
We do have some features related to this topic in our development backlog aimed at improving this as well:
Therefore, it's important to note that internal comments are exclusive to projects set up within the JSM product scope. Unfortunately, this feature is not available for JSW and JWM projects.
For the JSM project:
Create an automation rule for when a comment is added to the ticket it will verify if the comment is external or internal, and then copy the comment to the linked ticket from a JSW or JWM project. You can create an IF condition to separate/distinguish the Internal or External comments, using the smart value below:
{{comment.properties."sd.public.comment".internal}} "equals" true or false
Some tips
In order to automatically add the comment as a project role (in this example I used the "JSM & JSW Communication" custom project role, you can use other roles as you wish), you will need to add this project role to the project Comment Permissions and also add the Automation for Jira user to this project role, to do this go to View Project Roles of Automation for Jira user and add the specific project role (for me, the "JSM & JSW Communication" role) directly in the projects that you are using, or access directly via this link below (replace <yourinstance.atlassian.net> with the URL of your Atlassian cloud instance):
https://<yourinstance.atlassian.net>/secure/admin/roles/ViewUserProjectRoles.jspa?accountId=557058%3Af58131cb-b67d-43c7-b30d-6b58d40bd077
- As you can see in the screenshot below:
Otherwise, the automation rule will fail with the message: "You are currently not a member of the project role: XXXXX. (commentLevel)"
If you choose to use a Group instead, I would recommend checking if your instance has Group & Project Roles enabled for Comment visibility, see below how to check this:
- Check under JIRA Settings > System > General Configuration for "Comment visibility" and make sure it's set to "Groups & Project Roles" and not "Project Roles only"
For the JSW or JWM projects:
First, to access comment properties, you can use the {{comment}} smart value.
For instance, if you want to access the body of the comment, you can use {{comment.body}}. And, if the comment has properties like visibility, you can access them using {{comment.visibility}}.
For example, if you want to access the "type" field inside "visibility", you can use {{comment.visibility.type}}. Similarly, for "value" and "identifier" fields, you can use {{comment.visibility.value}} and {{comment.visibility.identifier}} respectively.
Therefore, in my example, I'm using the "JSM & JSW Communication" project role for internal comments, so the IF condition will be:
{{comment.visibility.value}} "equals" JSM & JSW Communication or Empty
Extra tips
In order to avoid confusion with linked tickets, I recommend creating a specific type of link only for this use case. As demonstrated in my example, I utilized the "comments linked in" custom link type. For further details, please refer to the documentation provided below:
As in JSM we have the background color in yellow for internal comments, unfortunately this does not apply to restricted comments in JSW and JWM, we also have an item in our development backlog aimed at improving this as well:
Therefore, to ensure clarity between restricted and public comments within your team, I recommend customizing the restricted comments to appear in a distinct color. For example, I use the smart value below in my automation rule to show the comment text in red and the internal link to the original ticket where the comment was made:
[~accountid:{{comment.author}}] commented the following:
{quote}??{color:#de350b}{{comment.body}}{color}??{quote}
~Original comment made on [{{triggerIssue.key}}|{{triggerIssue.url}}]~Or, as a workaround, you can use the panel macro. This will allow you to set a color for the background of your text. Here's how you can modify your smart value to include a yellow background:
{panel:bgColor=yellow}
[~accountid:{{comment.author}}] commented the following:
??{color:#de350b}{{comment.body}}{color}??
~Original comment made on [{{triggerIssue.key}}|{{triggerIssue.url}}]~
{panel}But please be aware that the icon associated with the color macro will also appear in the copied comment, as you can see on the screenshot below (using red and yellow color as a example):
Therefore, if the icon isn’t a concern for your use case, you can utilize any HTML color name or hex code for the "bgColor" parameter. Here are some examples:
{panel:bgColor=red} // Red background
{panel:bgColor=blue} // Blue background
{panel:bgColor=green} // Green background
{panel:bgColor=yellow} // Yellow background
{panel:bgColor=#FF5733} // Orange background (using hex code)Please remember that the color rendering may vary depending on the browser and the display settings of the user.
This workaround will work as I demonstrate in the screen recording below:
Bruno Altenhofen
Atlassian Engineer - The guy from Proforma(Jira Forms)
e-Core
Krakow - Poland
1 accepted answer
4 comments