Hello,
I want to create an Jira automation rule that will propagate down fix version information from parent to child, for example from Story to Subtasks. At the same time, I want to copy down labels from parent to child as well.
In my example, I have these definitions in the Story:
"Fix versions" = ["8.2", "8.x"] (two strings)
"Labels" = ["hello", "goodbye"] (two strings)
I have read several posts which looks very similar to my case, like https://community.atlassian.com/t5/Jira-questions/How-to-make-sub-task-in-a-story-or-task-inherit-fix-versions/qaq-p/2109235
Unfortunately, there where not enough for me to understand how I should solve my problem, however similar it looked :(
I know how to set up the rule trigger I want, I can branch out over the subtasks correctly, but I'm having difficulties how to to do the assignment of the field/array. (I believe this perhaps has to do with fix versions being a multi-value field)
Questions:
1. Why is there no 'copy from trigger issue' option in Edit issue, like there already exists for labels field? (this helped my propagate down Labels information, half the task solved).
2. Since the easy assignment was not enaugh, I had to go to Advanced. Here, should "update" + "add" be used, or "fields"?
3. Since the target field is an array, can it be addressed by the name "Fix versions" anyway? (I found no other allowed syntax, but ...)
4. Since the source field is also an array (the parents information in field 'Fix versions'), how should it be referred to?
5. I've seen several different ways to access an array and also to transform the content, asJsonString, asJsonStringArray etc. Do I need to transform the content of the source data at all, when I really just want to copy (or add) the whole source field (whole array content) into the target array?
What I currently have tested (which fails with JSON error, as shown in audit log for automation) is this code snippet:
I hope someone here can help me understand what I'm doing wrong.
Thanks in advance
//Niklas
First thing, there is a copy for fields like Fix Version...it is just a bit tricky to find it. This can be done without the advanced edit JSON when you want to replace the value.
If you want to add values from the Story to the Subtask's existing values, this is a more complicated solution which does require using the advanced edit JSON for fields like Fix Version to add values using update.
Next, this scenario often requires multiple rules, with different triggers. And so the edits (in the copy-from) may be different. Please consider at least:
Kind regards,
Bill
Thanks Bill, that 'hidden' way to use the more simple way to copy Fix versions from trigger issue worked like a charm!
Funny that Atlassian has implemented the UI so differently for these two fields, but at least now I've found a new way to search for built-in functionality.
Much appreciated !
Just out of curiosity, how could I have implemented the same 'copy Fix version from trigger issue' in JSON code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am glad to learn that helped.
In that link I provided, documentation walks through the specifics for updating fields with JSON. The technique you use depends on if you want to replace or add to the existing values. Let's assume you want to replace the values in the Subtasks with those from the Story.
The simplest syntax for this is to use the fields shortcut , as shown below. Again, let's assume the trigger issue is the Story and you want to edit a Subtask...which you have branched to. Let's also assume there is only one value for the fixVersion.
In the rule's Issue Edit action, you would select More options to add JSON. When using this method, do not select the field from the dropdown at the top of the action, as you will change it with JSON.
{
"fields": {
"fixVersions" : [ { "name": "{{triggerIssue.fixVersions.first.name"} ]
}
}
The fixVersions field is a list and can contain multiple values. So we add the first function to specifically select that item as we are assuming there is only one.
When you have multiple values to copy/edit, the JSON needs to be a bit more dynamic. Atlassian has added some other functions to help with that, and you can learn more about them here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-json-functions/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Bill Sheboy and @Niklas Malmberg :)
Regarding:
> If you want to add values from the Story to the Subtask's existing values, this is a more complicated solution...
If I understood correctly this can be achieved in the "Copy from" dialog too, they have added a "Add to existing values" checkbox.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @roberto -- Welcome to the Atlassian Community!
Yes, and...that option did not exist originally for rule actions. Instead the changelog was needed to address this.
Kind regards,
Bill
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.