Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Automation - Remove a component

Hello guys, I would like to know how to remove a component from the Jira automation, I tried the documentation, but it was not clear for me. I know that would be from a JSON, but didnt work for me.

The code would be, every time a trigger happens, remove the component 'abc'.

 

 

3 answers

1 accepted

2 votes
Answer accepted

Thank you @Kian Stack Mumo Systems , I looked through 18 pages, and didn't see this one.

The second solution was missing some information (The variable {{compsCsv}} converts {{comps}} variable with CSV delimited by string quotation (")), but I got the necessary knowledge to do the automation.

I thought there was something simpler, similar to what is presented in the documentation:

"components": { "required": false, "schema": { "type": "array", "items": "component", "system": "components" }, "name": "Component/s", "hasDefaultValue": false, "operations": [ "add", "set", "remove" ]

Anyway, it works. Thank you very much!!

My solution:

Strutucture:

img03.png

Solution:

  1. Create a variable (issueComponents) to receive all the components

    {{#issue.components}}{ 'name': '{{name}}'} , {{/}}

    output:

    { 'name': 'Component 1'} , { 'name': 'Component to be removed'} , { 'name': 'Component N'} ,

  2. Create a variable (updatedIssueComponents) to remove a specific component and format the string (remove the last comma, and replace the quotes) to be used in a advanced JSON editing

    {{issueComponents.remove("{ 'name': 'Component to be removed'} ,").substringBeforeLast(",").replace("'","\"")}}

    output:

    { "name": "Component 1"} , { "name": "Component N"}
  3. Edit the issue with a JSON input

    {

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

    }

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 29, 2023

I'm glad you got it working!

Like Gabriel Chaves likes this
3 votes
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 28, 2023

@Gabriel Chaves

 

You should check out this page - it looks like @Bill Sheboy answered a very similar question in some great level of detail, so full credit to him for that!

If you do run into trouble with the implementation, I'd be happy to help troubleshoot your issues.

 

Thanks,

Kian

here is the most easy way to do it:

In JSON format in a modify issue use this syntax:
{
"update": {
"components": [{
"remove": {"name": "Component_Name_To_Remove"}
}]
}
}

Suggest an answer

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

Atlassian Community Events