Build list of stakeholders based on list of products

Alistair Adams March 30, 2023

I want to build a list of stakeholders based on a list of products.

Everytime the product list changes I run an automation rule. In that rule the first thing I do is clear the list of stakeholders (its a custom multi-select userid field). 

If I terminate the script immediately after this I know it works as the Stakeholders field in the issue is cleared.

BUT, if immediately after clearing the stakeholders I print it the list of stakeholders it hasn't changed. I'm using this string in the Audit Log message:

Stakeholders {{issue.fields.Stakeholders.accountId.asJsonObject("id")}}

It's almost as if Jira automation has a local copy of Stakeholders and the issue doesn't get updated till the script has completed. Can someone verify if this is the actual behavior? I haven't been able to find anything in the documentation to support this theory.

My idea was to do a series of "if product contains xyz" etc. then build up the list by adding the users to the stakeholder list depending on which product items have been set (there can be more than one stakeholder per product).

 

1 answer

1 accepted

0 votes
Answer accepted
Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023

Hi @Alistair Adams and happy Monday.

Not totally sure if this helps but have you tried to re-fetch data in your Automation rule to make sure the newest data is available to the rule?

re-fetch.png

HTH,
KGM

Alistair Adams April 3, 2023

Hi @Kristján Geir Mathiesen happy Monday to you!

Well, I hadn't looked at the Re-Fetch action so thank you for pointing me to that!

It did the job though does slow things down but can live with that. I'm now scratching my head trying workout how Jira has implemented this because that wouldn't have been the obvious solution to me :). It seems more analogous to a sync on Unix/Linux and if they'd used that name I might have found it myself.

So, for posterity, here's how I solved it. I first cleared the Stakeholders. Then I have several of these If:matches that all follow the pattern below.

In the Edit issue I used the "Copy from issue" (I removed the names that would be added after that for privacy). Without the Re-fetch action it would just use whatever names were in the issue when the automation was triggered. 

I'm always open to see if people have better ways of doing this. 

Screenshot 2023-04-03 at 10.21.35 AM.pngScreenshot 2023-04-03 at 10.22.29 AM.png

Kristján Geir Mathiesen
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2023

Glad you've got it figured out, @Alistair Adams !

Suggest an answer

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

Atlassian Community Events