How to add components to issues with automation rules in Jira

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud, Server, and Data Center - This article applies equally to all platforms.

   

Summary

This article shows how to add/append Components to Issues in Jira using Automation Rules from Automation for Jira.

Environment

  • All versions of Jira 7 and 8.
  • Automation for Jira (both lite and full)


Solution

Basic mode

You can accomplish the task using basic mode by:

  1. Selecting the Component/s field
  2. Selecting "Copy from issue" on the values box
  3. 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.




Last modified on Jul 16, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.