I am trying to make a rule where when an issue is assigned to a specific set of users, the component field is updated to include a specific component, let's call it "kitttens". I got this automation working, however, it's replacing the values in the component field with "kittens". I want it to say "kittens" and "puppies".
Well this is embarrassing, I solved my own problem =)
In case anyone else needs it, the answer in the automation is edit issue-> components-> "kittens" and "copy from issue"
Glad you found it! Sorry we couldn't get to you before then. ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do you enter a component in addition to Copy Components from Current Issue? My UI only allows me to select Copy Components from Current Issue and I can't enter anything else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am also looking for the answer to this. I want to add to existing values in the Components field. Right now my options are only Set or Copy. I would love the options to be the same as it is with Labels where you can specify Set, Add/Remove, or Copy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chad Vernon and @Karen Corbeill
It appears you want to add additional components, rather than replace or copy them.
To do that, you would use the advanced edit with JSON options. Unfortunately I do not believe you can add just one component value with JSON, like with Labels. Instead you must capture all the existing ones first, add the additional one, and then set them all at once.
Here is a rule which can do that for Jira Cloud. The same can be done with Server/Data Center versions by eliminating the created variables and doing this in one step.
{
"fields": {
"components" : [ {{varNewComponents}} ]
}
}
How this works...
Please try that and let the community know if you need further help with 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.
This looks great! I'll have to give it a try. Thank you so much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How do you deal with the case where varCurrentComponents is empty so the resulting json in the last action is invalid?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chad Vernon
You can use the conditional handling to test for the empty value, and only include/use the JSON when needed. This could also be done with a rule condition.
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.
I ended up using:
{"name": "New Component To Add"} {{#if(not(varCurrentComponents.isEmpty))}}, {{/}} {{varCurrentComponents}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I had the same problem: "copy from issue" wasn't available.
Luckly the Jira knowledge base helped out: https://confluence.atlassian.com/automationkb/how-to-add-components-to-issues-with-automation-rules-in-jira-1021222395.html
append one component
{
"update": {
"components": [{
"add": {"name": "Name of the Component"}
}]
}
}
append multiple components
{
"update": {
"components": [{
"add": {"name": "Name of the Component"}
},
{
"add": {"name": "Name of another Component and so on"}
}]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This solved it for me, thanks! I was trying to set one or more components according to one or more asset objects ("App") that were set on the request.
To make sure I'm not appending components to an incorrect initial set, I first clear the component field and then iterate over the asset objects.
JSON for the advanced edit issue fields action:
{
"update": {
"components": [{
"add": {"name": "{{ProductApp.Component}}"}
}]
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Almuth Boehme _Communardo_
First thing: for the piece of the rule you show, there is an Edit on the Components field and then they are apparently updated again later, but without first using the Re-fetch Issue action. As a result, the later edits may not work as expected.
Next, using an advanced branch over the values may lead to errors and collisions in the edits. The reason is branches which could be on more than one thing are executed in parallel and asynchronously, with no guarantee of processing order or when the branch will complete...up until the last step of the rule. This means each attempted edit with the JSON could collide, and potentially fail.
This is why the other posts in this thread suggest using one single edit which iterates over the values, creating a single JSON expression.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am certain that rule may have problems with collisions in the future, and strongly suggest changing it. The log may not show errors; instead some component values will either not save or will be "walked over" during later saves.
To learn more about such branch behavior, please see this note in the documentation: https://support.atlassian.com/cloud-automation/docs/jira-automation-branches/#Ordering-of-branch-executions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tested checking the field values on the issues, not the audit log. Up to 16 components were no problem. When components are updated each new component added is a single action according to the history on the request, even if you do it manually and it looks like you made only one save action to the components field. Therefore I think branching isn't much of an issue as long as it's an append action.
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.