Forums

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

Automation Rule - add component, not override

Tina Leszkiewicz
Contributor
March 8, 2023

Hello there!

 

How do I add a component to a ticket using automation, not override the existing values? 

 

Im creating an automation that needs to ADD a component when tickets are created in a project. The problem I'm running into is this is overriding any other components that may have been manually added during creation or already there from a recurring ticket.

I've seen some threads referencing some sort of JSON code or something... but most of these posts seem to assume that you have some knowledge of coding/computer stuff. As you can probably see, I do not have this kind of in-depth experience.

I found an article that says you can just add "copy from issue" - but this is from 2021 and this no longer appears to be an option at the moment. 

https://confluence.atlassian.com/automationkb/how-to-add-components-to-issues-with-automation-rules-in-jira-1021222395.html

 

Would somebody be able to explain exactly what I would need to change with my automation in order to achieve this? So fat, its a pretty basic build:

  • When issue created --> and project = Aud --> Then edit issue (component) (Component A) 
  • Screenshot 2023-03-08 at 11.36.03 AM.png

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.
March 8, 2023

Hi @Tina Leszkiewicz 

That article you linked to is for Jira Server/Data Center, and you appear to be using Jira Cloud.  Is that correct?

If so...you can still use the advanced edit with JSON described in the article.  Here is another article specifically for Jira Cloud on using JSON for edits.

To do that...

  • in your Edit Issue action, do not select the Components field from the dropdown list
  • instead, select the "More options", and in the "Additional Fields" section, enter this JSON with your new component.
{
"update": {
"components": [{
"add": {"name": "name of your new component"}
}]
}
}

You can also enter a smart value, if that is the source of your component name.

Kind regards,
Bill

Tina Leszkiewicz
Contributor
March 8, 2023

@Bill Sheboy Thanks so much, Bill! I didn't even realize the article was for the server and not the cloud.

But your answer is amazingly helpful! This is all I was looking for and I've been in and out of so many different rabbit holes that I feel like I was running in blind circles. Haha. Thank you SO much for your help! 

Like # people like this
1 vote
Answer accepted
Tina Leszkiewicz
Contributor
March 8, 2023

For those looking for an answer to my second question (which is down below) about how to add 2 components, I have the correct JSON code format, courtesy of Atlassian Support chat. 

Screenshot 2023-03-08 at 3.17.23 PM.png

0 votes
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.
March 8, 2023

deleting duplicate post

Tina Leszkiewicz
Contributor
March 8, 2023

@Bill Sheboy Another quick question for you (if you don't mind)...

 

How would you format the JSON if you want to add an additional second component?

I'm realizing that my rule would run better with if/else conditions, so I'm trying to set up my "Else" to add two components if the field is empty. But all of my attempts have yielded some sort of "parsing error" so clearly I'm missing something

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.
March 8, 2023

Tina, would you please post what you have tried thus far for that case?  I believe this is possible with conditional smart values...the trick may be getting the correct conditions so the item before has a trailing comma.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events