I'm attempting to send a Teams notification to anyone who is @mentioned in the comments of any issue. So far I have a rule that captures the user id of any user that is @mentioned in a comment. I took it from @Bill_Shaboy from an old thread (https://community.atlassian.com/t5/Jira-Content-Archive-questions/Need-to-add-all-the-users-mentioned-in-the-comment-to-the-custom/qaq-p/2061760)
The code is
{{issue.comment.last.body.split("\n").match("\[~accountid:(.*)\].*")}}
Once all of my mentioned users are in there I would like to print the user names in a Microsoft teams message. Right now the message is printing user ids which are gibberish. So far the rule looks like the attached picture. Any help on next steps would be appreciated.
After the GDPR changes for privacy, the account id values are all that is available from the mention.
If there was just one user, you could call the REST API functions to get their name. But with multiple users that might not work because of limitations with list iterators.
An elaborate work-around for the multiple user scenario could use a custom field:
Kind regards,
Bill
Thanks for the info that doesn't seem too difficult to implement. One quick question.
Is my current MentionedUser variable storing those user ids as one long string or as different values of some other data type in an array?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Based on the image shown, I expect that match() results in comma-separated values of the account ids as text. (I always write stuff like that to the audit log after the action to confirm it contains what I expected.)
To use that as a list, split your variable with split(",") and iterate over it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline 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.