Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to append a new release to the Fix Version without overwriting the existing releases values?

vincenzo.spatafora
Contributor
September 18, 2024

Dear Community,

I would like to create an automation rule in order to append a new release to the Fix Version field containing already other releases.

I have found this post:

Update multiple fix version with automation for jira | Automation | Atlassian Support

and follow the given instructions.

Unfortuntaley, you get the following error against step 4 instruction:

 

(Version id '' is not valid (fixVersions))

Do you know as why?

Can somebody help me out?

Thanks, Vincenzo.

 

4 answers

2 accepted

1 vote
Answer accepted
Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Hi @vincenzo.spatafora 

 

The doc seems to be related to JIRA Cloud not JIRA DC.

Not sure what the trigger of the automation is but you can append FixVersion by using the edit issue action and FixVersion field with the following value.

ac-fixVersion.png

In this example if add V1 to the current list of versions.

Regards

Ponnappan Ganapathiya
Contributor
September 18, 2024

I believe it works in Jira DC too.

vincenzo.spatafora
Contributor
September 18, 2024

Hi @Florian Bonniec,

thanks a lot.

I have tried that out as well and it works BUT:

if the Fix Version array field has got already more than 1 element (release value), the automation rule is overwriting all the existing Fix Version field values which I don't want.

Do you see a way out?

Thanks, Vincenzo.  

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

What is the trigger you are using and where does the version to happen come from ? Is it always the same ? Is it a version from another field ?

vincenzo.spatafora
Contributor
September 19, 2024

Hi @Florian Bonniec

first of all I confirm that the issues and releases belong to the same project whose Jira DC version is 9.12.12.

In my case, the trigger is Issue Linked and the condition Fix Version not empty.

If so, the rule is supposed to update the linked issue fix version field with the value of the destination issue; it does that but it also overwrites the exisiting fix version values, so I've come across the item I have posted in my question description.

I have followed your suggestion and as said it works but overwriting the existing values:

Fix_Version.PNG

I understand there is a work aroud by using the Advanced Edit but I don't get right the JSON syntax or genuily there is a bug.

Thanks, Vincenzo.

Ponnappan Ganapathiya
Contributor
September 19, 2024

EditIssue.PNG

What happens if you try this?

 

Florian Bonniec
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 19, 2024

Have you try this configuration ?

 

fixVersion.png

Select FixVersion then ... > Copy From and the config above.

Check add to existing values

Regards

Like vincenzo.spatafora likes this
vincenzo.spatafora
Contributor
September 19, 2024

Hi @Ponnappan Ganapathiya

thanks: it does nothing, I understand because in this specific case the issue is the trigger issue.

Cheers, Vincenzo.

vincenzo.spatafora
Contributor
September 19, 2024

Thank you @Florian Bonniec

yeah, that's the way to do it; it works.

So true: sometimes you are in the woods and you don't see the tree.

Kind Regards, Vincenzo.

vincenzo.spatafora
Contributor
September 19, 2024

@Dick @Ponnappan Ganapathiya @Florian Bonniec @Bill Sheboy

thank You very much for your help, very appreciated.

Grazie, Vincenzo.

Like Ponnappan Ganapathiya likes this
0 votes
Answer accepted
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 18, 2024

Hi @vincenzo.spatafora 

The article you linked-to is for Jira Cloud and it describes replacing by update, not appending to the list of Fix Versions values.

For Jira Server / Data Center, please use the name attribute for Fix Version instead of the id.

And, use the "add" syntax with "update" to append to the list.

To see examples of this syntax, please look here: https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html

Kind regards,
Bill

vincenzo.spatafora
Contributor
September 19, 2024

Hi @Bill Sheboy ,

nice to hear from you.

Do you mean like this:

{
"update": {
"fixVersions": [
{
"add": {“name”:"{{destinationIssue.fixVersions}}"}
}
]
}
}

You get: 

Edit issue

Error while parsing additional fields. Not valid JSON.
I don't understand as why it's not valid; the syntax seems correct to me.
Thanks in advance, Vincenzo.
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 19, 2024

There can be multiple values in the Fix Versions, and so they must be iterated over with an "add" for each one:

{
"update": {
"fixVersions": [
{{#destinationIssue.fixVersions}}
{ "add": { "name": "{{name}}" } } {{^last}}, {{/}}
{{/}}
]
}
}

 

Like vincenzo.spatafora likes this
vincenzo.spatafora
Contributor
September 19, 2024

Thank You @Bill Sheboy , works indeed.

Very appreciated, thank a lot and I have tried that out with "id" (instead of "name") and for your info, with Jira DC 9.12.12 it's working too.

Have a nice evening, Vincenzo.

Like # people like this
1 vote
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Hi @vincenzo.spatafora

the smart value in the example might be missing the closure tag:

 

{
"fields": {
    "fixVersions": [
        {{#issue.fixVersions}}{"id": "{{id}}"},{{/}}{"id": "{{version}}"}           
        {{/}}
    ]
  }
}
vincenzo.spatafora
Contributor
September 18, 2024

Thanks Dick,

I have tried that out and you get now the following error message:

Error while parsing additional fields - Mismatched start/end tags: null != in template

Cheers, Vincenzo.

Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Hi Vincenzo,

on hindsight, I see the {{/}} in your equation. Then you proceed with a comma, followed by your own version smart value {{version}}. 

 

You can let the automation log the 

{{#issue.fixVersions}}{"id": "{{id}}"},{{/}} "id": "{{version}}"
part of the json. 
You want to see that you're extending the existing values separated by comma's with the new value. 
First check the string you're receiving, then put it in the variable :)
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

There's a couple of curly braces that I left out intentionally. Try the above please.

Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Total should be:

{
"fields": {
    "fixVersions": [
        {{#issue.fixVersions}}"id": "{{id}}",{{/}} "id": "{{version}}"   
    ]
  }
}
Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Within the square brackets is the array of strings. 

In JSON format that would be something like ["string A", "String B", "String C"]

that's why I removed the curly braces around your array elements. 

 

JSON format referral

vincenzo.spatafora
Contributor
September 18, 2024

Thanks Dick.

You get now:

Error while parsing additional fields. Not valid JSON.

I use Jira Data Center version 9.12.12.

Kind Regards,

Vincenzo.

 

Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 18, 2024

Okay, then it's not a complete string array, but an array of objects needing the single curly braces to encompass each element in the array... 

{
"fields": {
    "fixVersions": [
        {{#issue.fixVersions}}{"id": "{{id}}"},{{/}}{"id": "{{version}}"}           
        
    ]
  }
}
Can you log the value of smart values 
{{#issue.fixVersions}}{"id": "{{id}}"},{{/}}
for me?
vincenzo.spatafora
Contributor
September 18, 2024

Thanks @Dick for your time.

So, the syntax from the post above is correct (in step 4).

Here the log:

FixVersion_Array_values.PNG

Dick
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 19, 2024

Vincenzo, what is the value of the smart value {{version}} from your automation? 

vincenzo.spatafora
Contributor
September 19, 2024

Hi @Dick,

I get no value out of it from the log and no error from the log.

By the way, it seems we got to use "name" instead of "id".

Cheers, Vincenzo. 

0 votes
Ponnappan Ganapathiya
Contributor
September 18, 2024

Hi Vincenzo,

Could you paste the exact json string you used for this rule?

vincenzo.spatafora
Contributor
September 18, 2024

Thanks @Ponnappan Ganapathiya,

there you go:

{ "fields": { "fixVersions": [ {{#issue.fixVersions}}{"id": "{{id}}"},{{/}}{"id": "{{version}}"} ] } }

Cheers, Vincenzo. 

Ponnappan Ganapathiya
Contributor
September 18, 2024

I create a replica of this its working good. I think the problem is not with this part.

Ponnappan Ganapathiya
Contributor
September 18, 2024

Could you please confirm the version and the issues belonging? Maybe the condition missing or conflict with the project where the version is created.

vincenzo.spatafora
Contributor
September 19, 2024

Hi @Ponnappan Ganapathiya,

I confirm that either the issues and releases belong to the same project.

Are you using DC or Cloud?

Cheers, Vincenzo. 

Ponnappan Ganapathiya
Contributor
September 19, 2024

@vincenzo.spatafora I am using DC 9.12.7

Hope you have validated the manual operation too. Like create a version and add that to the issues matching the condition you provided in the automation.

Regards,

Ponnappan.

Suggest an answer

Log in or Sign up to answer