Update Multiple Choice Fields Using Automation in Jira
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Updating a select field with multiple choices using a JSON formula can be challenging.
This article provides examples and rules to update this field type, using either:
Explicit values
Content of single-choice select fields
Content of multiple-choice select fields
Other types of fields, such as a text field
Solution
Scenarios
For each scenario below, we will assume that the custom field we are trying to update is Select List Multiple Choices. If your field's name is different, please make sure to change it in all the scenarios provided below.
Scenario 1 - Update the select field (multiple choices) with explicit values
To replace the content of the field with specific values:
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the options in the Select List Multiple Choices list
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your field, and the values you want to add to it)
1 2 3 4 5 6 7 8
{ "fields": { "Select List Multiple Choices": [ {"value" : "Option 1"}, {"value" : "Option 2"} ] } }
To edit the field without overwriting its original content:
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the options there, in addition to the smart value {{issue.Select List Multiple Choices}}. Adding this smart value will prevent the rule from deleting the original content.
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your field, and the values you want to add to it)
1 2 3 4 5 6 7 8
{ "update": { "Select List Multiple Choices": [ {"add": {"value":"Option 1"}}, {"add": {"value":"Option 2"}} ] } }
Scenario 2 - Update the select field (multiple choices) with the content of select fields (single choice)
To replace the content of the field with values coming from 2 select fields (single choice)
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the list of options list below
{{issue.Select List Single Choice 1}}
{{issue.Select List Single Choice 2}}
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1
2
3
4
5
6
7
8
{
"fields": {
"Select List Multiple Choices": [
{"value":"{{issue.Select List Single Choice 1.value}}"},
{"value":"{{issue.Select List Single Choice 2.value}}"}
]
}
}
To edit the field without overwriting its original content:
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the list of options below, as shown in the screenshot:
{{issue.Select List Multiple Choices}}
{{issue.Select List Single Choice 1}}
{{issue.Select List Single Choice 2}}
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1
2
3
4
5
6
7
8
{
"update": {
"Select List Multiple Choices": [
{"add": {"value":"{{issue.Select List Single Choice 1.value}}"}},
{"add": {"value":"{{issue.Select List Single Choice 2.value}}"}}
]
}
}
Scenario 3 - Update the select field (multiple choices) with the content of another select field (multiple choices)
To replace the content of the field with values coming from another select field (multiple choices)
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the option {{issue.Select List Multiple Choices 2}}
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1 2 3 4 5 6 7
{ "fields": { "Select List Multiple Choices": [ {{#issue.Select List Multiple Choices 2}}{"value":"{{value}}"}{{^last}},{{/}}{{/}} ] } }
To edit the field without overwriting its original content
Option 1
Add the Edit Issue action
Select the field to update using the option Choose the fields to set to
Enter the option below
{{issue.Select List Multiple Choices 1}}
{{issue.Select List Multiple Choices 2}}
Option 2
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1
{"update": {"Select List Multiple Choices": [{{#issue.Select List Multiple Choices 2}}{"add": {"value":"{{value}}"}}{{^last}},{{/}}{{/}}]}}
Scenario 4 - Update the select field (multiple choices) with the content of a text field (single line)
Let's assume that:
You configured a Single Line Text field that will be filled in with comma-delimited values (for example, "Option 1, Option 2, Option 3")
You are trying to populate the select field (multiple choices) based on the values that are listed in the Text Field
To replace the content of the field with the values listed in the text field
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1 2 3 4 5 6 7
{ "update": { "Select List Multiple Choices": [ {{#issue.Select List Multiple Choices 2}}{"add": {"value":"{{value}}"}}{{^last}},{{/}}{{/}} ] } }
To edit the field without overwriting its original content
Add the Edit Issue action
Expand the More Options setting
Use the JSON formula below (make sure to update it, based on the name of your fields):
1 2 3 4 5 6 7
{ "update": { "Select List Multiple Choices": [ {{#issue.Text Field Single Line.split(",")}}{"add": {"value":"{{.}}"}}{{^last}},{{/}}{{/}} ] } }
Was this helpful?