Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Finding Mentioning a User in Comment ... and Custom Field User Picker (multiple users) check

Christoph Schulz May 19, 2023
  • Finding the Mentioning of a User / s in last Comment

than add to...(Watcher...or a Custom Field...) adding leads to another question

 

  • Costum Field User Picker (multiple users) check difference

check if a user already got a mail, it is used for group works since its a custom field user wont get notified. i managed to inform them via comment or email spam everytime the value of picker changes.

But it would be much better if i could just sent a message to the last person/s added an email and avoid duplicates.

Iam not sure how i can split the picker and check for values.

 

2 answers

1 accepted

1 vote
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2023

Hi @Christoph Schulz 

Your scenario seems to be: when someone is mentioned in a comment the first time, I want to add them as a Watcher (or to a Custom Field), and send them an email.  When the user is mention again later I do not want to add them to the field again or send another email.

Does that sound correct?

For a question like this, I recommend posting images of your complete current rule and the audit log details showing the rule execution.  Those will provide context for the community to offer suggestions.

Without that information...

It appears you have already learned how to find and extract and account ID value from a comment mention.  If you pull out all possible mentions from the last comment, your rule could use an advanced branch to iterate over them.  Then use an advanced compare condition to determine if they are already listed as a Watcher (or in the Custom Field), and only proceed if they do not exist yet in the field.

Kind regards,
Bill

Christoph Schulz May 22, 2023

Almost yes,

iam struggling at this part "how to find and extract and account ID value from a comment mention."

So my Automation would start like Task commented, find the mentioning, than use the account ID for an email or add as a watcher.
(Task commented > compare {{issue.comments.last.body}} has [~accountid:  )

 

The custom field, i have trouble with the many account IDs it saves. So when an Automation starts i have all the accounts, and i will send them all an email even if they were before inside of the custom field. 

Yes an advanced compare, to figure out the difference between the newest vaule of the field and the last in a log i guess. I want to subtract the accounts which are doubled to get the unique ones and sent them a mail to inform them, you are on the task. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2023

Would you please post images of your complete current rule, and show the details of your branch and advanced compare condition, and of the audit log details showing the rule execution?  Those may provide more context for making suggestions.  Thanks!

Christoph Schulz May 22, 2023

image.png

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2023

Let's try this one piece by piece...

First, mentions in comments store only the account ID for a user.  To find all of the users mentioned in the last comment, the expression below works.  It would split a comment into lines, find mentions, and then extract the account id values.

{{issue.comments.last.body.split(" ").match("(accountid:.*)]").remove("accountid:")}}

That can produce a list of the users, and so they must be iterated over in an advanced branch.

For your scenario, you only want to email the users who are not already watching the issue...and so they must be tested, one by one.  And so an example rule would be:

  • trigger: issue commented
  • action: create variable 
    • variable name: varAddWatcher
    • smart value: {{issue.comments.last.body.split(" ").match("(accountid:.*)]").remove("accountid:")}}
  • advanced compare condition:
    • first value: {{varAddWatcher}}
    • condition:  does not equal
    • second value: leave as empty
  • advanced branch:
    • smart value:{{varAddWatcher.split(",")}}
    • variable name: varWatcher
      • advanced compare condition:
        • first value: {{issue.watchers}}
        • condition: does not contain
        • second value: {{varWatcher}}
      • action: add watcher, {{varWatcher}}
Like Christoph Schulz likes this
Christoph Schulz May 23, 2023

Exactly this 🙌

Perfect!

Thank you for the lesson and continue to support.

.

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 24, 2023

Awesome!  I am glad to learn that helped, and also...

Using automation rules often requires both experimentation and learning.  To help with those I recommend building skills by:

  • look at the examples in the template library to learn how they solved problems
  • look at posts/examples in the community to see if others have already solved a problem you are trying to address...this can be tricky, as people describe things differently, so I recommend using a web search to find the posts in the community :^)
  • create a test project (at least) or a free Jira instance (at better) to experiment and "break things" while trying out rules.
  • regularly go look at the documentation pages, as they continue to improve over time
  • think outside the box: often rules cannot solve a "problem" and pausing to consider why something is needed may reveal a better solution

Happy experimenting!

Like Christoph Schulz likes this
Marcel Rossouw April 15, 2024

This automation rule works like a charm - the only downside is that even if no new mentions are made, the rule runs as a 'success' with message: 

{{smart values}} condition
The following issues did not match the condition:

With Jira software rolling out automation cap/limits is there a way for this rule to be updated to only be successful when a mentioned user is actually tagged in a comment? In other words this rule will trigger any comment made on tickets and mark it as a 'success' greatly increasing the amount of times the automation rule runs.
Christoph Schulz April 15, 2024

The lowest amount of rule runs would be trigger manualy. 

or via Date/Time event window.

Marcel Rossouw April 15, 2024

Yeah, only way around is if it strictly matches a JQL query condition however not sure you can target all users for comment/description field. CurrentUser() exists but not a catchall parameter for all other mentioned users to use in a JQL query.

0 votes
Christoph Schulz June 28, 2023

Before Iam totaly stuck .. is there an easy way to get Email changed in a custom Field ? otherwise would i have to add @ domain and remove, replace everything around the display name ? But i will run into display name is not the full name in mail problems..

@Bill Sheboy 

My tries are

 

1 {{addedfieldChange.valueIds}}                                                  id numbers         
11 {{addedfieldChange.valueIds.emailAddress}}


2 {{addedfieldChange.emailAddress}}


3 {{addedfieldChange.values}}                                                   display names
33 {{addedfieldChange.values.emailAddress}}

4 {{fieldChange.to}}                                                                    [list of id numbers]
44 {{fieldChange.toemailAddress}}
444 {{fieldChange.to.emailAddress}}

5 {{fieldChange.fromemailAddress}}

8 {{changelog.customfield_10034}}                                  only custom field name worked 
88 {{changelog.customfield_10034.emailAddress}}

9 {{customfield_10034}}
99 {{customfield_10034.emailAddress}}                        this worked but it gives me old and new

9999 {{customfield_10034.last.emailAddress}}                                       just last email
99999 {{customfield_10034.addedfieldChange.to.emailAddress}}
999999 99999 {{customfield_10034.addedfieldChange.emailAddress}}

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 28, 2023

Hi @Christoph Schulz 

I recommend starting with the changelog to learn what is available for your field.  Remember changelog will only include the fields which changed during an edit, and perhaps not other cases.

{{#changelog.yourCustomField}}{{fromString}}{{/}}

And the current value should be in the {{toString}}

Regarding the differences between the email address, displayName, and full name, you may not have access to that unless you are using a Jira user field (with an accoundId).

Kind regards,
Bill

Christoph Schulz June 29, 2023

Hello @[deleted] 

It's a User Picker (multiple users) called Mitwirkende Personen 

I would like to sent an email to Omar Darboe in this example

  

thats the changelog written in the task
Christoph Schulz hat Folgendes aktualisiert: Mitwirkende Personen 28. Juni 2023 um 15:15 [Chat Notifications, Jie Yan Song]----[Chat Notifications, Jie Yan Song, Omar Darboe]

 

{{changelog.Mitwirkende Personen}}

ChangeItemBean{fieldId='customfield_10034', field='Mitwirkende Personen',fieldType='null',from='[5b70c8b80fd0ac05d389f5e9, qm:b81e873f-658f-47e0-b05b-48fec4419b59:75b1855b-71eb-4000-93f4-b0f1f081015d]',fromString='[Chat Notifications, Jie Yan Song]',to='[5b70c8b80fd0ac05d389f5e9, qm:b81e873f-658f-47e0-b05b-48fec4419b59:75b1855b-71eb-4000-93f4-b0f1f081015d, qm:b81e873f-658f-47e0-b05b-48fec4419b59:a1654234-e66e-4113-82ba-0ff38c8b6400]',toString='[Chat Notifications, Jie Yan Song, Omar Darboe]'}
 

 

{{#changelog.Mitwirkende Personen}}{{fromString}}{{/}} 

[Chat Notifications, Jie Yan Song] {{toString}}

 

{{addedfieldChange.valueIds}}    qm:b81e873f-658f-47e0-b05b-48fec4419b59:a1654234-e66e-4113-82ba-0ff38c8b6400

{{addedfieldChange.values}}    Omar Darboe

Christoph Schulz June 29, 2023

can i set up a tempory or hidden user field in background that fills in only the changed value and sent an email to them ? and after that its done it will clear the data again... shouldnt be this the easiest way ?

it will have the ids, no need to edit anything. the only thing is i need to take care of is that nobody would touch that field.

like a cache

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2023

You could use an entity property for that; rules can set/read them and they would not be on the screen.

Would you explain further: why do you need to save the value when you want to notify the changed users each time?

Like Christoph Schulz likes this
Christoph Schulz June 29, 2023

The Email only accepts people fields, if i use it on all Mitwirkende Personen it would result in spam to people who were inside the Field before.

i've tried sent the mail to {{addedfieldChange.valueIds}} but it said its empty so.. i guess it's the only way to save it, is in a new field ?

""You could use an entity property for that; rules can set/read them and they would not be on the screen."" Not sure how this works ive tried use my account as property for the key and the value but it can't the mail to the {{key}} because its empty 🤷‍♂️

Christoph Schulz June 29, 2023

sorry didn't read why, the custom field has no notification by default (like assign) the people get added and the project leader would have to write a comment or sent a group mail to inform them.

That's too complicated.. so i try to automate an easier way, also that other people can understand what i did.. if iam out of office and have to troubleshoot it. 

 

Not sure if the Team Field will get notification soon.

Christoph Schulz June 29, 2023

But sometimes there are random people from 2 teams so it probably has to be a custom field.

Like Bill Sheboy likes this
Christoph Schulz June 29, 2023

custom requests like this are difficult @Bill Sheboy .. maybe i need to convince them its easier to use watchers since its an integrated feature and could sent notifications and ... all by default. 

 

watcher is a user field or ?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 30, 2023

Yes, the watcher field is a multi-select user field.

Like Christoph Schulz likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events