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.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.