Hi
In a hierarchy which has Milestone and Feature levels above Epic, I need to make Features inherit a multi-select field from their parent Milestone when they are created.
In testing I have created a rule that works for a single select field, as described in my answer to this question. But how to make it work for a multi-select field? The variable contains a comma-separated list. How can I manipulate that so that each value is added to the field on the created Feature?
Can I split the comma separated list into a new smart value that can be branched on?
Any other suggestions welcome, if there is a better way of going about this.
Thanks
Hi @Julia Foden
Without seeing your rule, I suggest the answer is "maybe". Please take a look at advanced branching for options to iterate over the values from a list. (You may use list functions and the CSV values you note to drive the branching.)
Kind regards,
Bill
Hi @Bill Sheboy
This is what I have
Strategic Initiative is a multi select field and the log output is a comma separated list. If there is just one value it edits the field on the trigger issue correctly.
I tried branching over the variable {{SI}}
and then using this to update the field
but the error was
(Option value 'ABC, XYZ' is not valid (customfield_16576))
Is it possible to manipulate my variable {{SI}} (comma separated list) in such a way that Advanced Branching recognises it as a list that can be branched over?
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, now that you have confirmed that {{SI}} contains a comma-separated values (CSV) list of the data you want, change the Advanced Branch to use:
{{SI.split(",")}}
That will convert it into a list which is then input to the branch.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah thanks @Bill Sheboy , that's the final hurdle!
What a palaver though, to copy one field from the parent. Do you happen to know if there is a feature request in to enable copying a field from the hierarchy parent, in the same way that we can from the Epic, trigger issue etc?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually no @Bill Sheboy I spoke too soon. It works fine if there are 1 or 2 values in the list. But if there are more it only copies 2 values to the child.
I tried with 3 values and 4 values and in my advanced branch I logged the value before going into the edit action. Both times it logged each value correctly, but only 2 values were added to the child. And not necessarily the first two in the list!
I guess this is because all the branches were simultaneously trying to edit the same field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Argh, branches! :^)
Okay, branches which process more than one issue are executed asynchronously, and there is no guarantee of when they will finish...so, your writes may be walking over each other as the loop progresses.
Let's try this: in the branch, after you make the edit to add the value, insert a Re-fetch action. This will reload the issue before proceeding, dramatically slowing down the rule, and improve the chances of all of the values sticking.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Aaarghhh indeed!
I tried with the re-fetch but it still only added 2 values :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm... Would you please post an image of your current, complete rule, and of the audit log from an execution where it only adds some of the values?
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.
Puzzling that still doesn't work; still gotta be the branching.
I can think of one other way to try this: Get rid of the branch on the created variable, and try to update directly by forming the JSON using list functions.
First, create a new variable, named SIJson, with the value from your first branch, instead of {{SI}}
{{#issue.Strategic Initiative}} "add": { "value":"{{value}}" }, {{/}}
Then try to use that variable in a JSON edit of your trigger issue's field (without the second branch)
{ "update": {
"customfield_16576": [ {
{{SIJson}}
} ]
}
}
Sorry, if that does not work, I am stumped, and it may be time to submit a support ticket to see if they can help: https://support.atlassian.com/contact/#/ Your site admin can do that if you are on a paid Jira license.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I finally got it working @Bill Sheboy , thank you for your suggestion.
The variable as you suggested is
{{#issue.Strategic Initiative}} { "value":"{{value}}" }, {{/}}
And then the edit is
{ "fields": {
"customfield_16576":
[{{SIJson.substringBeforeLast(",")}}]
}
}
Thank you very much for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! I am glad to learn you got it solved.
FYI for that list to build the string: you can also use conditional logic to not add the last comma, and so eliminate the need for the call to substringBeforeLast()
{{#issue.Strategic Initiative}} { "value":"{{value}}" }{{^last}}, {{/}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Bill. Can you please point me to any good documentation on this, and other possibilities. I've not seen {{^last}} before.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wish there was better/more organized documentation on smart values. Until that improves, it helps to read over all of the examples to learn what is possible.
For example, here is the stuff on lists where you can see things like {{^last}}
https://support.atlassian.com/jira-software-cloud/docs/smart-values-lists/
And also this list of sources from the automation product team:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.