Is it possible to duplicate the "Component" value to a custom field using automation?

Ami Heller October 5, 2021

I'm looking to duplicate the value from the OOTB Component field to a custom text field using automation rules. However, the drop-down for "Field to copy value from" does not list the OOTB Component field. Any thoughts on this?

Screen Shot 2021-10-05 at 12.59.15 PM.png

2 answers

2 accepted

2 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.
October 5, 2021

Hi @Ami Heller -- Welcome to the Atlassian Community!

There are a few ways to do this copy, depending upon the outcome you want to achieve and the type of your destination, custom field.

If you want to just copy to a text field, a separated values list, you could type this smart value into the field: {{issue.components.name}}

To get that smart value in the field source, just start typing the smart value, it will appear below the field, and you may select it when done so it is used.

If instead your destination field is defined, multiselect field, you will probably need to use advanced edit with JSON to edit the field: https://support.atlassian.com/jira-software-cloud/docs/advanced-field-editing-json/

And...if neither of those methods work, please consider posting an image of your audit log and describe what you observing happening when the value does not copy.  Thanks!

Kind regards,
Bill

Ami Heller October 5, 2021

Thank you, Bill! The simple copy to a text field was what I was looking for. Appreciate your help! 🙏

Like Bill Sheboy likes this
Michal Stanczyk February 25, 2022

As I had a similar issue (wanted to copy Components into the other dropdown) I will add my solution (based on JSON edit which Bill mentioned):

 

{
"fields": {
"customfield_xxxxx" : {{issue.components.name.asJsonObject("value").asJsonArray}}
}
}

It will copy all of the components into the other custom multi-select field. Note here, your custom field has to contain the same values as you have defined as components.

Like # people like this
Максим Валгин December 20, 2022

Omg, Michal, thank you very much!

Arthur Felipe Rech August 31, 2023

Thanks a lot for this Michal!

1 vote
Answer accepted
John
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 5, 2021

Hey @Ami Heller 

The "copy from" selection will only allow you to copy the same type of value (e.g. I can copy other text fields but not the label field). Components are a special Jira field, there are multiple values associated with a component.

To copy the value from a component to a plain text field you will need to use a smart value. The {{issue.components.name}} will list all the current components as plain text. 

This is what your rule might look like:

Screen Shot 2021-10-06 at 9.35.26 am.png

This will appear as a comma separated list in the field:

Screen Shot 2021-10-06 at 9.39.54 am.png 

Documentation for reference: https://support.atlassian.com/jira-software-cloud/docs/smart-values-general/

Hope that helps!

- John

Ami Heller October 5, 2021

Thank you very much, John! Very helpful. 🙏

Suggest an answer

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

Atlassian Community Events