Forums

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

Automation : Help with MultiSelect field to MultiSelect field

Thiago Hartmann March 28, 2022

Hello! I'm trying to create an automation, but I'm failing to do so. Any kind of help is appreciated :

 

I have a Product field with multiple values:

p1.png

 

I also have a Components with the abbreviation of each of those Products (among other values):

p2.png

 

What I would like to do is to automatically update the Components field based on what the user selects in the Product field.

So I managed to create an automation which updates the field and everything works. But it always replaced the value instead of "keep the existing ones and add the new one".

I found this page here : https://support.atlassian.com/cloud-automation/docs/edit-issue-fields-with-jira-automation/

As you see from the section Add values to multi-select fields, it should be fairly simple as I can just select 'Copy from Issue' and then also together, add the new value. The screenshot below shows the example for that:

p3.png

However, my JIRA (cloud version) doesn't have that option to 'Copy from issue'.

Any idea how can I achieve that (or any other ideas on how to do that in an easier way is also appreciated).

Thanks,

 

 

 

 

1 answer

1 accepted

2 votes
Answer accepted
Fernando Eugênio da Silva
Community Champion
March 29, 2022

@Thiago Hartmann 

Can you share the full details of your Cloud automation?

I did some tests here and I can confirm that Cloud has the "Copy value from issue" option, but I didn't want to give you an answer that might not be so helpful.

If you can share how your automation is formed, maybe I can help you fix it and get the expected result.

Thiago Hartmann March 30, 2022

Hi @Fernando Eugênio da Silva , thank you for helping out on that issue.

I took a screenshot here of all the steps, here it goes:

p4.png

 

As you see, it's a really simple rule. 

What happens now is that on the 'Edit Issue' (the 3rd step), when selecting the component, I can only select the existing ones. I don't have an option to 'Copy from issues'.

If I click on the [ ... ] next to the component field, then I have those options, but in none of them I managed to add 'AV'+ 'Copy from Issue', It's either one or another.
p5.png

Thiago Hartmann March 30, 2022

Also just to add on that issue, there was a previous post and I believe the user had the same issue as me, but as you can see, his screenshots don't load and neither he answered my follow-up on how he solved :


https://community.atlassian.com/t5/Jira-Service-Management/Inability-to-add-values-to-multi-select-fields-using-automation/qaq-p/1923750?tempId=eyJvaWRjX2NvbnNlbnRfbGFuZ3VhZ2VfdmVyc2lvbiI6IjIuMCIsIm9pZGNfY29uc2VudF9ncmFudGVkX2F0IjoxNjQ4MTQ4NTYzMTU2fQ%3D%3D#U1982391

Perhaps the discussion above can bring some light in the solution of this problem?

Fernando Eugênio da Silva
Community Champion
March 30, 2022

@Thiago Hartmann 

The "ADD existing values" feature to components is only available using "Copy from".

The only possible way for you to do this is as follows:

Add a new ACTION of yours where you select the "AV" component

In this new ACTION, select the EDIT issue for the "Component" field and this time make the formula for the "Copy from".

Keep the "ADD existing values" checked and the value will be added normally next to the "AV" component.

This is the logic you should use. First add the choice component, then add a new "copy from" selection component ACTION:

71.PNG

The first ACTION would be from COMPONENT "AV" and the second ACTION would be from Component "Copy from".

They need to be in this order.

I tested it here and it worked perfectly.

Test and let me know if you have any problems.

Regards,

Fernando

Fernando Eugênio da Silva
Community Champion
March 30, 2022

@Thiago Hartmann ,

Another solution that I ended up developing here very quickly and practically and that certainly works is to use the JSON language to update the Component adding the value you want.

See the payload below:

{
"update": {
"components": [
{
"add": {
"name": "AV"
}
}
]
}
}

For that you don't need to put the Component in the EDIT issue function. Just enter this payload here:

72.PNG

Just select "EDIT ISSUE";

Do not select the "Components" field;

Click on "Additional FIelds" and include this payload.

Jira will only ADD to existing components, the one you are including in the payload :D

Kind Regards,
Fernando

Like # people like this
Thiago Hartmann March 30, 2022

Fernando, you are a legend!

I tried both ways and it worked.

I ended up going with the json snippet, so I could keep the structure of my automation a bit leaner.

Thanks a lot for your help! That's very appreciated. I'll mark your post as a solution in case other people have the same issue.

Thanks a lot again, I wish you a wonderful day!

Like # people like this
Chris McCullough
Contributor
December 6, 2022

@Fernando Eugênio da Silva I'm still having trouble with this myself when trying to add additional values to a multi-select field using the steps above.

I have two "Edit Issue" components after an IF condition to check if the description contains corresponding keywords.

  1. The first selects one of the options in the multi-select field
  2. The second adds the existing values in that same field from the current issue.

Then I have subsequent IF conditions that check for other keywords and then two more Edit Issue components after each of those doing the same thing. The first step on each one seems to be adding the new value but then it's overwritten immediately by the next Edit Issue component...

What am I doing wrong here and why is this so diffffffficult?

Step 1.pngStep 2.png

Chris McCullough
Contributor
December 6, 2022

I've also tried the alternate suggestion using the following:

{
"update": {
"Download Options": [
{
"add": {
"name": "ABC"
}
}
]
}
}

This does add the value to that field but then subsequent "Edit Issue" components don't add their values too. 

For example if the one above is first in line, the "ABC" option is selected. But if I have a second "Edit Issue" component after that with the following:

{
"update": {
"Download Options": [
{
"add": {
"name": "DEF"
}
}
]
}

 This should add "DEF" as an option in addition to "ABC" but I end up with just "ABC".

Chris McCullough
Contributor
December 6, 2022

Ah ha! I found something that worked,

I needed to use "value" rather than "name" when referencing my field

{
"update": {
"customfield_10116": [
{
"add": {
"value": "ABC"
}
}
]
}
}
Fernando Eugênio da Silva
Community Champion
December 6, 2022

@Chris McCullough 

Great!! I would say to you change "name" to "value", it's because custom field select list (multiple choices) are different than "Components" field in jira.

Glad to hear you made it lol

Any questions, let us know

best

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events