For our new Jira project we need to be able to add a mentioned user in a comment to the collaborators field.
I have tried to use different smart values but I wasn't able to differentiate a mentioned user from a comment.
Is there a way to differentiate usernames/accountId's from a comment?
You note having tried a few things, so perhaps it would help to post an image of your rule and the audit log details. That will provide context for the community to offer ideas. Thanks!
Writing automation rules often require experimentation to learn how things like mentions work in Jira.
For example, try writing the last comment's body to the audit log with {{issue.comments.last.body}} and you will see how mentions are implemented as text. That information will help you to create a regular expression to extract each of the mentioned users accountId values using the match() function, and then add them as collaborators.
Kind regards,
Bill
Hi @Bill Sheboy ,
Thanks for your help, I managed to find a post which also managed a similar question. I saw that you commented there as well and managed to do something with the combined information.
As of now I managed to create something like this:
With this automation I can add a single user to the collaborator's field based on a users split accountId.
The problem I'm facing now is that I also want to be able to add multiple mentioned users to the collaborators field, but when I do that now only the first mentioned user gets their accountId split and the second users keeps their accountId in tact. Here is a little example:
I hope you can help me out with this problem, it would be greatly appreciated!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just did a test where I separate the users with a bit of text and in that instance the accountId does get split but it won't add the users to the Collaborators field, I think because of the field seeing the 2 id's as one 1 id.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The match() can return multiple values, and so if you try that as the source for an advanced branch, you can loop over the values to add each one as the Issue Edit action would be inside of the loop:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy ,
Thanks for your insight.
I finally managed to get the automation to work by creating a loop with the advanced branch on the Match() smart value.
Use case:
When a Jira user gets mentioned in a comment, we want the user to be added to the Collaborators field (without removing any present Collaborators).
Jira automation screenshot:
Automation JSON:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Damian de Vries Thank you for sharing the JSON, this worked great for adding users to the Request participants field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm trying to get user ID when the user is mentioned - to be able to use it in automation and send additional info to the same user - but with no luck.
and I'm using: {{comment.substringBetween("[~accountid:","]")}}
automation end with success but returns no value :-(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Comments have several attributes, and you may want to use the body of the specific comment you need, last, first, etc. as described here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--issue.comments--
And I recommend writing the comment value to the audit log first to help confirm your text function is extracting what you need.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dam
Recently I read this article about auto-linking an issue mentioned in a comment.
I hope it can give you some ideas on how to parse the comment and get the username or account id, even though the regex should be quite different...
Good luck!
Cheers,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.