Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,379
Community Members
 
Community Events
165
Community Groups

Need to add all the users mentioned in the comment to the custom field

Hi, I need to add all the users mentioned in created comment to custom field Cooperators. 

Cooperators is a field with type "User Picker (multiple users)".

 

How to do it in Jira automation?

Thanks in advance for any suggestions.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Martin Fukatko 

A couple of ways to do this are with an advanced, smart value branch to loop and with a single edit:

  • Loop: Use a regular expression with match() to parse the users' account ID values out of the comment, and then use that result as the input for an advanced branch.  Within the branch use an advanced edit with JSON to add the user to the field.
  • One step: Use the regular expression to parse the users' account ID values, wrapping the result with the proper syntax to add them all at once using a JSON edit.

Please consider if you want to clear or add to existing Cooperator values if multiple comments occur.

This is a complicated rule to write, so I recommend doing it one step at a time and writing the intermediate results to the audit log before making any edits to the issue.

Kind regards,
Bill

@Bill Sheboy 

Bill, thank you for answer.

Don't you have an example for "regular expression with match() to parse the users' account ID values out of the comment" ?

Hi, Martin.

Writing automation rules often requires experimentation.  I encourage you to try things, such as writing comments to the audit log, to learn more about how Jira implements things like mentions...as that will give you ideas for how to parse them with regular expressions.

To get you started, this expression will return a list of user account ID values for the last comment added:

{{issue.comment.last.body.split("\n").match("\[~accountid:(.*)\].*")}}

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Jira Software

Upcoming changes to epic fields in company-managed projects

👋 Hi there Jira Community! A few months ago we shared with you plans around renaming epics in your company-managed projects. As part of these changes, we highlighted upcoming changes to epics on...

14,856 views 37 49
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you