Automation Rule for Copying "Component" Field Value to "Team" Field

Neil Goodwin
Contributor
March 5, 2025

Hi all,

We are using Automation Lite on an older version of Jira Server.  I am trying to copy the value of the OOTB "Component" multi-select field to the OOTB "Team" single-select field.  Both fields have the same values, so it exists in each.  Can someone assist with the needed JSON for this, as that appears to be the only way.Screenshot 2025-03-05 125436.jpg

 

I reviewed the options here and not able to get it to work: 

https://confluence.atlassian.com/automationkb/automation-for-jira-how-to-update-a-select-field-multiple-choices-from-the-content-of-other-fields-1236449082.html#AutomationforJiraHowtoupdateaselectfield(multiplechoices)fromthecontentofotherfields-Scenario2-Updatetheselectfield(multiplechoices)withthecontentofselectfields(singlechoices)

1 answer

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 5, 2025

Hi @Neil Goodwin 

The Component field could have multiple values and the Team field can only have one.  What do you want to do if there are multiple Component values?

Next, please identify the custom field ID for your team field, such as customfield_12345.  Once you have found that, please try this expression, assuming there is only one Component value:

{
"fields": {
"customfield_12345": {
"value" : "{{issue.components.first.name}}"
}
}
}

 

Kind regards,
Bill

Neil Goodwin
Contributor
March 5, 2025

Hi @Bill Sheboy 

Oh, that was my bad, not thinking of that obvious use case.  I need to double check with my user on this. 

I am guessing they will say "Can we just add whichever Component was just added to the issue as the Team?"  If this is the case, is there a JSON for adding the newest (just added) component to the Team field?

I tested this and the error is 'Error editing issues Key-123 (operation must be string (customfield_15870)).  The 'Team" field is unique (type is Team), but behaves like a single select.

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 5, 2025

You could use the field change smart value for the added value: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

I recommend testing to confirm this one works as expected: {{addedfieldChange.values}}

 

And, my mistake as you are using one of the built-in Team fields.  Please try this, assuming the trigger is Issue Field Changed for Components and only one value was added:

{
"fields": {
"Team": "{{addedfieldChange.values}}"
}
}

If that does not work with "Team", please use the "customfield_15870" in the JSON.

Neil Goodwin
Contributor
March 6, 2025

Hi Bill,

When I changed the JSON to yours above using "Team" or "Component" is not EMPTY, It is successful, but nothing changes.

I have limited options on the trigger (due to the "Lite" version).  My trigger is "Issue Updated" with JQL condition = "Component" is not EMPTY.  This triggers the rule as expected.Screenshot 2025-03-06 081143.jpg

- I then tried a new trigger of "Issue Property Updated" and {{issue.components.name}} but could not get it to trigger.   

Suggest an answer

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

Atlassian Community Events