How to copy values between multiple choice fields via automation.

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

One would want to create a new issue in another project with select fields. However, there's a problem with using automation to copy multiple choice field values from a Jira Service Management project to Jira Work Management project.

Source JSM project

Recipient JWM project

 

The problem is the smart value get converted to a single item rather than a list, e.g. products (a, b) is converted to a single item "a,b" (rather than "a" and "b" ) and it doesn't match any options. This will leave the receiving multiple choice field as blank. 

Environment

Jira Service Management Cloud | Jira Work Management Cloud | Jira Discovery (Beta). 

Solution

Go to your Project Settings > Automation and start a new rule with the following components:

New trigger: Select the trigger that meets your design requirements.  

Create variable action. Give the variable a name and set smart value of the multiple choice field. 

{{#issue.customfield_id}}{"value": "{{name}}"},{{/}}

Since multiple choice fields often times have more than one value. Use of # symbol will iterate through those values and store them as a variable.

(info)When using #, you must close the expression with {{/}}.

Helpful Links:

Create Issue, select your JWM project and Issue type, Select Copy From for Summary field.


Select Choose fields to set drop down, select field.  More options, using JSON to set values on target project field.


{
    "fields": {
       "customfield_10486": [{{ProductVar.match("(.*)(?=,)")}]
       
    }
}

The use of regex is needed to parse through the values as a list and stores them in the JWM project multiple choice field properly. 

This is a workaround for bug AUTO-93.

Last modified on Sep 28, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.