Forums

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

How to copy multi-select field value into Affects Versions field?

Kelvin Teng September 10, 2024

Hi,

Appreciate some advice from the community on how to copy multi-select custom field values into Affects Version field.

For example, I have a multi-select custom field called Software Version and have multiple options selected in the field. Like Version 1, Version 2, Version 3.

In the automation, I've configured it to copy the Software Version -> Version 1, Version 2 and Version 3 into Affects Versions field when linked to another issue.

So far I have not been successful to make it to copy multiple values into Affects Versions field. But it works if it is copying a single value.

Thank you everyone in advanced.

3 answers

0 votes
Marc - Devoteam
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.
September 11, 2024

Hi @Kelvin Teng 

If you update your rule, first in the log action, change the smart value to {{triggerIssue.customfield_12721.value}}

And add another log action and use {{triggerIssue.customfield_12721.name}}

See what both actions log.

then we can move forward.

Kelvin Teng September 11, 2024

Hi Marc,

I've added log action for {{triggerIssue.customfield_12721.name}}, nothing is in the log

Screenshot 2024-09-11 163133.png

Marc - Devoteam
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.
September 11, 2024

Hi @Kelvin Teng 

But on value option you have information, so this is what we need.

Now create a variable, based on smart value {triggerIssue.customfield_12721.value}}

Use this variable in your edit action in the branch

0 votes
Dick
Community Champion
September 11, 2024

Hi Kelvin and Trudy,

The multi-select variable yields a list of consecutive values as an answer. In order to tell Jira it has to work with a list during the copying to the destination issue, you need to use {{#issue.multivariable}} similar to Atlassian on smart values and lists So the edit process should definitively be an advanced edit, not a regular one.

Kelvin Teng September 11, 2024

Hi Dick,

I've tried using advanced edit with the following:

{

"versions": {{triggerIssue.customfield_12721.value}}

}

And it returns the error below:

No fields or field values to edit for issues (could be due to some field values not existing in a given project)

I've also tried putting quotations "{{triggerIssue.customfield_12721.value}}" doesn't seem to help

Dick
Community Champion
September 11, 2024

The essential part (the multi-value part) is in the hashtag # :

And triggerissue has no capitals (no camel casing).

The value parsed should imo be part inside the loop in object notation: {{value}}

And the "human readable" name of the customfield should be used.

And you should close the multi-value part with the slash: {{/}}

{{#triggerissue.Affects Versions}}{{value}}{{/}}

Dick
Community Champion
September 11, 2024

you can log the above line (make visible what it parses and see if it matches what should be the "value" copied.

0 votes
Trudy Claspill
Community Champion
September 10, 2024

Hello @Kelvin Teng 

Please show us screen images of your entire rule and the details of each step, so that we can advise you how to modify it.

Also please share the output in the rule execution log for the rule executing and trying to copy multiple values.

Kelvin Teng September 10, 2024

Hi Trudy,

Thank you for your assistance.

Screenshot 2024-09-11 100927.pngScreenshot 2024-09-11 100852.png

Trudy Claspill
Community Champion
September 10, 2024

What are the details of the Create Variable step?

What is the actual result? What is the value of the Affects Versions field when this rule executes?

A Variable is generally stored as a String. Attempting to copy a single string of comma separated values into a multiple selection field is not generally going to work. Instead you would have to do some parsing of the values and potentially some branching to get each value added as another value in the multi-select Affects Versions field.

Kelvin Teng September 10, 2024

Hi Trudy,

Thank you for the quick response. The actual result is empty. There is no value populated in Affects Versions field. Below is the screenshot of the Create Variable step.

Screenshot 2024-09-11 133131.png

Instead, you would have to do some parsing of the values and potentially some branching to get each value added as another value in the multi-select Affects Versions field.

May I know how I can do this?

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.
September 12, 2024

Hi @Kelvin Teng 

Adding to Trudy's suggestions...

Do you want to replace the values in the destination issue's Affects Versions field or add to the existing values?

What is the type of your source, custom field: multiple-selection Version, multiple-section Option, something else?

 

If you want to replace the values and the source field is already multiple-selection, version type, the edit issue action could directly copy them, using the COPY option to the right of the field in the action.

For all other cases, your rule will need to use advanced edit with JSON to add the values by the name of the versions: https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/#Affects-Versions

That may be done by iterating over the values in the source custom field to dynamically create the JSON for use.

Kind regards,
Bill

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