Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Automation Rule for copying one specific component from an epic to a story or task

Cayce McCraw April 15, 2025

Our project uses multiple components on epics, features, stories, and tasks. I am trying to create a JIRA automation rule to copy one specific component to a child issue when created or epic link is edited. 

I am able to create the rule to copy all components from the epic based on the epic link - values changed trigger, but the use case I have is to copy one specific component out of many. 

Looking forward to the assistance!

3 answers

2 accepted

3 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2025

Hi @Cayce McCraw -- Welcome to the Atlassian Community!

When adding (or removing) a specific Component value, please use the advanced edit features with a JSON expression: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Components

In that documentation, also see the examples for the Labels field to see how to add a value using the "update" attribute.

 

If this does not help, please post the following for context:

  • your version of Jira: Cloud, Server, or Data Center
  • for Cloud, your project type: company-managed, team-managed, JPD, etc.
  • an image of your complete rule, in one continuous image
  • an image of the Edit Issue action
  • an image of the audit log details showing the rule execution
  • explain what is not working as expected and why you believe that to be the case

 

Kind regards,
Bill

Cayce McCraw April 15, 2025

Thank you for helping me! I've entered the JSON based on documentation above, however, I am receiving errors saying JSON is not valid. 

Automation Rule.JPGAutomation Error.JPG

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 15, 2025

First, you are using Jira Server / Data Center, and so the JSON documentation for that version may be found here: https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html

 

Next, please read the JSON documentation carefully, and note I also described looking at the Labels field for an example to use the "update" attribute.

As an example for the Components field, that would be this for the values you show:

{
"update": {
"components": [
{ "add": { "name": "FPS O&M" } },
{ "add": { "name": "FPS Program" } }
]
}
}

 

Also note well: in the Edit Issue action, you have selected the Components field from the dropdown list AND used JSON.  Only one of those can be used at a time for the same rule action for a single field.  De-select the field from the dropdown list.

Cayce McCraw April 15, 2025

Thank you for the quick response - I was able to successfully use the above to add both components, however, my initial question may not have been clear. I need to "copy down" or "add" either "FPS O&M" or "FPS Program" components depending on which component the Epic has - the epic would have one or the other, but not both. The epic could also have additional components such as multiple team names/components, so a straight copy of all components down to the story or task level wouldn't work either as stories and tasks would be worked by different teams. 

I really do appreciate your time, and hopefully this clarification will help get us closer to resolving my dilemma!

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 16, 2025

Thanks for clarifying the scenario, and...

When you want to selectively add one or the other Component, please use an if / else block in your rule to make that decision with conditions.

Like Cayce McCraw likes this
Cayce McCraw April 16, 2025

Thank you so much for your assistance!!! The JSON was a game changer, thank you!

Like Bill Sheboy likes this
0 votes
Answer accepted
Davide Schillaci
Contributor
April 16, 2025

Hi @Cayce McCraw ,

Welcome to Atlassian community!
You could try something like this:

Screenshot 2025-04-16 093109.png

Let me know if it works for your scenario.
Bests!

Cayce McCraw April 16, 2025

I need to copy down one out of many components to the story and task created under a specific epic, not all the components from the epic. 

Scenario: Epic A has 3 components "Component 1", "Component 2", and "Component 3"

Given a new story or task is created

When the epic link is added/updated in the story or task

And the matching epic has "Component 1"

Then I want the automation rule to copy only "Component 1" to the story or task

And ensure "Component 2" and "Component 3" are not copied. 

Davide Schillaci
Contributor
April 16, 2025

Hi,

have you already tried setting a related issue condition based on Epic?

Screenshot 2025-04-16 182038.png

Then you should set the specific Edit issue action via JSON as already suggested in other comments.

Bests

Like Cayce McCraw likes this
Cayce McCraw April 16, 2025

This is perfect and worked like a charm!!!! Thank you!!!!

Like Davide Schillaci likes this
0 votes
Kim Euker
Community Champion
April 15, 2025

In this case you want to look at the Advanced Editing features.  You need to append your value to the existing components in the child.  Then, using the advanced editing you can update the components to have the existing components and the new components

{
"fields": {
"components" : [ {{AllComponents}} ]
}
}

 

Suggest an answer

Log in or Sign up to answer