I have a custom field of type Select List (multiple choices) - this is called Program Impact. Whenever this is updated, I want to update a short text field (called PI Abbr) with a string which is a concatenation of abbreviations for the multiple choices in the Program Impact field.
e.g. If Program Impact is updated and the choices
"Long textA" and "Long textC" are seldected, the resultant "PI Abbr" field contains
"CodeN, CodeZ". This is based on a lookup table in the rule shown below
LongtextA | CodeN |
LongtextB | CodeY |
LongtextC | CodeZ |
LongtextD | CodeA |
The rule is a single issue rule so the branch executes inline, so I have created a variable
varAbbrStr outside of the rule and was hoping to update that in the branch but can't work out how to concatenate those values. Alternatively I would concatenate the new abbreviation in each branch to the {{issue.PI Abbr}} field value but I think that would mean refetching every loop which will impact performance. In the rule, when the value changes for the Program Impact rule, I clear issues 'PI Abbr' field and create an empty variable varAbbrStr.. In the branch, I iterate though each value set in {{issue.Programme Impact}}, lok up its abbreviated equivalent in the lookup table and attempt to build a concatenation of each of the abbreviations lookup that I can use to finally set the "PI Abbr" field.
I have a workaround which is creating PI Abbr also as a multi-select and I could just set that each time arounf the loop. I prefer not to do that because then changes to the abbreviations means maintenance in two places, Jira custom field and the automation script
Hi @Rees_ Ian
Short answer: This scenario requires using an inline, iterator over the multiple-select, option field and a series of chained replace() functions to convert to the code / abbreviation string value. For example:
{{issue.myMultipleSelectField.value.join(", ").replace("LongtextA", "CodeN").replace("LongtextB", "CodeY")...}}
For more information...
You note this:
The rule is a single issue rule so the branch executes inline...
That is not correct. An issue branch on one-and-only-one issue (e.g., Branch to Current Issue) is executed inline, as if the branch did not exist. But branches which could-be-on-more-than-one-thing (e.g. branch on linked issues, advanced branch, etc.) are run in parallel and asynchronously. There is no way to accumulate the value of the text string using a branch.
There is a long standing, open suggestion to allow configurable parallel / serial execution. That is currently shown as "in progress" but there is no hint from the Atlassian team what they are planning to implement. Please watch here to learn more: https://jira.atlassian.com/browse/AUTO-32
Additionally, you are trying to use a Lookup Table for the replacement values. That cannot work with a long-format iterator because the table data is not visible once inside the iterator. That is, the following will not work:
{{#issue.myMultipleSelectField}}{{varLookupTab.get(value)}}{{^last}}, {{/}}{{/}}
This is another long standing, open defect / suggestion. My understanding is the Atlassian team has repeatedly tried to address it without success. Please watch here to learn any progress: https://jira.atlassian.com/browse/AUTO-490
This leaves three possible workarounds:
Kind regards,
Bill
Thanks Bill, I used a chain of replace functions as you suggested and it worked a treat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess the one thing I didn't understand in your answer was the visibility of the Lookup table. Within the branch the lookup on the lookup table that was defined outside of the branch seemed to work ok.
Also, the branch was on the values of the issues multi-select field, so it couldn't be multiple issues. Is what you are saying is that Advanced Branching branches are always executed in parallel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, my understanding is the Advanced Branch always executes in parallel as it could be zero-to-many items.
Recently, I noticed branch parsing getting "smarter" as a JQL branch was previously always run in parallel, and now a JQL branch over one issue is run inline. For example, key = TEST-123. That may be a handy trick for some scenarios.
What I meant about the Lookup Table visibility was:
THIS DOES NOT WORK!
{{#issue.myMultipleSelectField}}{{varLookupTab.get(value)}}{{^last}}, {{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Rees_ Ian
Pondering a bit further, this is the third question for this type of search (with a table) I have seen this week...and I did develop a much more elaborate way to solve it with dynamic list searching about two years ago. I even wrote an article on it in October 2024: : https://community.atlassian.com/t5/Automation-articles/Automation-concepts-Dynamic-searches-within-a-list/ba-p/2834235
For your scenario, the search technique would be used twice in a row:
If you want to try this, let me know and I will add more details.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.