Updating custom field values from lookup values in Automation logs all values but updates only some

Mikko
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!
March 13, 2024

Hi!

My goal is to update a custom label type field with values when fixVersion field changes. Values to update are lookup table values (since versions can't have custom fields attached to them) linked to version ids (key being version id, value being the label I want to display).

Automation goes like this:

  • When value changes for fixVersion
  • Build lookup table for fixVersion ids and words added to the custom field, for example 12345 = "foo", 23456 = "bar" etc., store as "baseValues"
  • Set customField with value "base"
  • And add value to audit log
  • If fixVersion is not empty
    • for each {{issue.fixVersions.id}}  saved as "fixVersionId"
    • if {{baseValues.get(fixVersionId)}} not empty
    • Add value {{baseValues.get(fixVersionId)}} to audit log
    • And edit issue custom field: add {{baseValues.get(fixVersionId)}}

This logs all values as you'd expect (base + foo, bar if both versions were selected). However the issue field is sometimes updated with only some of the lookup table values, not all of them. It seems to me that the order logging and adding is done has no role in this as it fails in both.

I also have another rule for when issue is transitioned to In Progress and it behaves the same.

Any advice what's going on and how to resolve this?

 

Mikko

1 answer

1 accepted

0 votes
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.
March 13, 2024

Hi, Mikko -- Welcome to the Atlassian Community!

For the rule you describe, there are a couple of potential challenges...

First thing, there are known problems with the change log and fix version field, such that it may not accurately reflect what has changed: https://jira.atlassian.com/browse/JRACLOUD-80486  There is no work-around for this defect, so your results may not be accurate if you only rely on the change log.  Depending upon your scenario, you may be able to use the current fix version values to decide how to update the custom field.  (As described below...)

 

Next, and specifically for your rule: you appear to be iterating over values using the advanced branch.  A branch which could be over multiple values runs in parallel and asynchronously, with no guarantee of when it will finish...up until the last rule step.  This means your rule could be repeatedly walking over the prior updates to the field.

The work-around for this scenario is to only use one update, when possible.  You could try the same iterator source to build a dynamic JSON statement to update your custom field, and then use a single edit with advanced edit with JSON to make all the changes.

 

Kind regards,
Bill

Mikko
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!
March 18, 2024

Hi Bill and thanks for the reply!

I'll have a look at those.

 

Mikko

Like Bill Sheboy likes this

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