Copy Multiple Choice Field Values in Jira Service Management Cloud Using Automation
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
Learn how to create a new work item in another project with Select List (multiple choices) fields.
There is an issue when using the automation to copy multiple-choice field values from a Jira Service Management project to a Jira Work Management project.
Smart values convert into a single item instead of a list. For example, products (a, b) are converted to a single item "a,b" (rather than "a" and "b" ). This then doesn't match any options and leaves the receiving multiple-choice field blank.
You can achieve this by using Regular Expressions (regex) to parse through the list. This solution can also be used as a practical workaround for the bug AUTO-93 - Using smart values to copy a multiple-choice field to a team-managed or discovery project does not work.
Environment
Jira Service Management Cloud | Jira Work Management Cloud | Jira Discovery (Beta).
Solution
Automation Rule using regex
Go to your Project Settings >Automation and start a new rule with the following components:
Trigger: Select the trigger that meets your design requirements.
Then: Add an Action: Create variable - Give the variable a name and set the smart value of the multiple choice field.
{{#issue.customfield_id}}{"value": "{{name}}"},{{/}}Multiple choice fields often have more than one value. Use the # symbol to iterate through those values and store them as a variable.
When using #, you must close the expression with {{/}}.
Helpful Links:
Then: Add an Action: Create Work Item.
Select your target project and Work Item Type.
Select Copy From for the Summary and Description field.
Select the Choose fields to set dropdown.
Select the Custom field to which you want to copy the multiple-choice field.
More options, using JSON to set values on the target project field.
{ "fields": { "customfield_10486": [{{ProductVar.match("(.*)(?=,)")}] } }The use of regex is needed to parse through the values as a list and store them in the target project's multiple-choice field properly.
Was this helpful?