Forums

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

Automation to populate a field from multiple fields

lila
Contributor
March 12, 2025

 

I feel this should be easy .. but somehow i cant get it to work ..

In Jira Discovery, I need an automation to populate a 'Discipline' field by combining the values from 'Team (IP)' and 'Dependency'. When either 'Team (IP)' or 'Dependency' is added or edited, the 'Discipline' field should update to show the combined values.

Currently, editing one field overwrites the other in 'Discipline', and using 'Add to existing values' results in not removing the old value. 

Somehow also the automation always shows as "successful" even though the Discipline field might not get updated. 

Screenshots attached 

Screenshot 2025-03-13 at 4.28.20 PM.png

Screenshot 2025-03-13 at 4.29.45 PM.png
Screenshot 2025-03-13 at 4.29.51 PM.png
The second "then: is identical to the first one but with "Copy Dependency from current issue"

Thanks a lot 

3 answers

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.
April 8, 2025

Hi @lila 

What is the type of your "Discipline" field: text, single-select option, etc.?

Please show an image of your current entire rule in one continuous image.  That will provide clarity for what you are seeing.  When the rule is larger than a single browser page, please use a screen capture tool or browser addon which support scrolling-page capture.

Also please post an image of the entire Edit Work Item action(s) you are using.  I suspect you are trying to update the field multiple times and that is causing this symptom.

Kind regards,
Bill

lila
Contributor
April 8, 2025

Hey Bill, Multi-select field.

There is not much more to show that the above, Here is he new one with the update based on comments suggested by others. 

Screenshot 2025-04-09 at 3.50.03 PM.png

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

Thanks for that information, and...

 

When using the Edit Work Item action, the field may be selected from the dropdown list or updated using a JSON expression, but not both in the same action.  For your scenario, please remove the selection from the dropdown list.

 

Next, you want to add a value not replace them, correct?  If so, the syntax for the JSON update would be this:

{
"update": {
"customfield_12345": [
{
"add": { "value": "{{issue.Team (IP)}} - {{issue.Dependency}}" }
}
]
}
}

Please note I used the custom field ID as an example.  You could try your field name as a smart value, "Discipline", and if that does not work, use this how-to article to identify the custom field id for your field.  The same may be needed for the fields "Team (IP)" and "Dependency"

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Please note I am assuming the "Team (IP)" and "Dependency" fields are plain text.  If those are single-select option, custom fields, their value attribute must be used:

"{{issue.Team (IP).value}} - {{issue.Dependency.value}}"

Again...using the custom field ID values when needed.

 

0 votes
Vishal Biyani
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 12, 2025

@lila 

Expanding on what @Mohanraj Thangamuthu has indicated, can you try something like below or whatever will be your separator

{
"fields": {
"Discipline": "{{issue.Team (IP)}} - {{issue.Dependency}}"
}
}

lila
Contributor
April 7, 2025

That didnt work :( 

lila
Contributor
April 7, 2025

Error as per below 

Screenshot 2025-04-08 at 9.39.38 AM.png

lila
Contributor
April 7, 2025

I did try add the array but that didnt work .. probably my json isnt correct 

If i add the array, i then gets a new error 

Screenshot 2025-04-08 at 9.44.20 AM.pngScreenshot 2025-04-08 at 9.45.13 AM.png

0 votes
Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 12, 2025

Hello, Good day. Use the JSON option to update the field as shown in the below link. https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

Suggest an answer

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

Atlassian Community Events