I comment a jira as follows:
hi @Lily @[deleted] it's a lovely day, isn't it?
I want to use jira automation to add lily and tom as the watchers, but don't know how to fulfill this. Could any guy help?
Thanks,
Craig
Until that suggestion is implemented, you could built this functionality yourself using Automation for Jira. For example:
To learn more about automation rules, please see this documentation and examples:
Kind regards,
Bill
Hey @Bill Sheboy - I'm a newbie to variable writing - do you have an example of what the action would look like here? We're trying to achieve the same thing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kit Friend
Here are more details on what I described to extract the account id values from the comments...
{{issue.comments.last.body.replace("[~accountid"," [~accountid").split(" ").match("(accountid:.*)]").remove("accountid:")}}
Kind regards,
Bill
UPDATED 2023-Feb-06: I updated the expression for varAddWatcher to split on spaces before searching for the accountId values.
UPDATED 2023-Jun-15: In the unlikely case there is no leading space between mentions, I updated the smart value expression to add a space before mentions and then split on them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy really kind of you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy have you had this working successfully for multiple users being tagged? It's working fine for me on single users, but errors when there's more than one. I'm wondering if it's to do with the initial variable creation action only creating the first one as a smart value...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kit Friend
Here is the fix below. This rule which I believed worked in the past stopped working when there were multiple mentions on the same text line. The improvement below first splits the comment by spaces into separate lines, and then tests each entry to find the accountId.
{{issue.comments.last.body.split(" ").match("(accountid:.*)]").remove("accountid:")}}
I tested this successfully for a few scenarios; please let me know if you see any other problems with it.
Thanks,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy I've been getting a (low number of) persistent errors where if multiple mentions are on the same text line without spaces or any punctuation between them, the amended rule fails. Did this come up in your testing?
i.e. this works fine:
but this fails:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kit Friend
No, I had not tried that scenario...and it failed for me also. I had to explicitly delete the space after the first mention to create this condition.
One work-around is to always ensure there is a space before the mention text and then split:
{{issue.comments.last.body.replace("[~accountid"," [~accountid").split(" ").match("(accountid:.*)]").remove("accountid:")}}
I will update my earlier answer to include this also.
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.
Thank you, very helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboy The auto-add doesn't seem to work when I mention a user without any preceding text or space before the mention. If there is a space or word ("Hi") then it does work. Is there a way to achieve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mark Lendrum -- Welcome to the Atlassian Community!
This scenario and solution approach has changed several times in community posts. Please try this one:
{{issue.comment.last.body.split(" ").match("\[~accountid:(.*)\]").distinct}}
That will produce a list of unique user account id values that were mentioned.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.