How to add components to issues with automation rules in Jira
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
This article shows how to add/append Components to Issues in Jira using Automation Rules from Automation for Jira.
Environment
Jira application version (on Server/Data Center) from 8.0.0, with any version of Automation For Jira.
Solution
Basic mode
You can accomplish the task using basic mode by:
- Selecting the Component/s field
- Selecting "Copy from issue" on the values box
- Proceeding to add the desired components to be added/appended to the Component/s field
Make sure that no json code is inserted on the advanced box below that, else it'll take precedence over the basic mode above.
If you don't select "Copy from issue", the Component/s field will be overwritten with the selected values only, erasing what was previously on the issue.
Advanced mode
If you need to make use of the advanced mode, you can add/append components to the issue with the code below:
{
"update": {
"components": [{
"add": {"name": "Name of the Component"}
}]
}
}
If you need to add/append multiple components at once, the below code will do:
{
"update": {
"components": [{
"add": {"name": "Name of the Component"}
},
{
"add": {"name": "Name of another Component and so on"}
}]
}
}
Please refer to the documentation on Advanced field editing - JSON for more info on editing fields on advanced mode.
Lastly, if you're appending components more than once on the same automation rule, be sure to use the Re-fetch issue data action before each new action — or else only the last issue edit action will work.