Automation to add watchers based on changed custom user field

Tim Feeley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2023

See audit log below.

When I iterate over my custom user ield, I can add everyone as watchers. However it's possible someone who is in the POC field explicitly unwatched this ticket before, so I don't want to re-add every POC on field change - just the deltas.

It looks like the smartValue for fieldChange is enclosed in brackets, which messes it up(?). Not sure if I'm doing something wrong here; I've tried passing in the {{fieldChange.to}} object directly (vs. iterating over it), and it seems like the dang nab array notation is confusing it :)

Screen Shot 2023-12-13 at 01.18.49.png

1 answer

0 votes
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.
December 13, 2023

Hi @Tim Feeley -- Welcome to the Atlassian Community!

Yes, that inconsistency in rules using arrays versus lists is challenging.  Often the work-around is to strip off the square brackets with text functions, and then use split() and trim() to convert into a list.

You do not show the details of your advanced branch values, and I suspect you are using the delta-value smart values for fieldChange: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

Please note there are quite a few typos in that particular section of the documentation and so you may need to experiment to find the correct smart values.

If not, perhaps try those to get only the adds and deletes for specific changes.

Also please note: the rule you show is using two different advanced branches, which could be on more than one value for each.  Any rule branches which could be on more than one thing are run asynchronously and in parallel.  Please take that into account in your rule as that may lead to unexpected results.

I recall suggesting an alternative to this approach a couple of years ago, using created variables to gather up the watchers to add and remove, and then making one single update using advanced edit with JSON.

Kind regards,
Bill

Tim Feeley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 13, 2023

Thanks Bill :-)

I'll give it a shot. I only used the two branches to examine the values for each, not as a requirement for real; thanks for the reminder! Will give it a shot.

For Atlassian: My use case would be more directly solved if JIRA (Discovery Board) let me specify userlist fields as a target for notifications - or if "Watchers" was a better integrated field in the grid :) 

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.
December 13, 2023

Yes, and...As JPD projects seem based upon team-managed projects, and those use those pesky "People" fields that have lots of rule problems, it may not yet be possible to do those notifications.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events