I am trying to do what I thought would be simple enough but I have hit a wall.
When an issue is transitioned (got this),
I want to ADD the earliestUnreleasedVersion() to the fixVersion field. All I can do at present is REPLACE the value.
Hi @jeff.kehler , for adding to existing field values you need to use advanced edit JSON. Is that what you are doing? Please see this article that illustrates this for the labels field. You can easily adapt to fixVersions. advanced-field-editing-using-json
Hi @jeff.kehler
Yes, and...to Jack's suggestions...
Once you have learned about making the updates with JSON to "add" a Fix Version, there are several ways to identify the earliest unreleased version to add it:
Kind regards,Bill
@Jack Brickey @Bill Sheboy All I am trying to do is ADD the "Next release by release date" to any existing values already present. I used the brute force method above.
I have the right values captured in variables. I get exactly what I want for the fixVersion field in my audit log. I just cannot find the path to get the values in the fixVersion field.
Capture existing values in fixVersion in new Variable
Set fix Version to Next unreleased by release date. Fix version is selected
Here I had to add a 5x re-fetch delay allowing time for logic to execute and populate fixVersion field.
Capture "new" existing value in fixVersion in new Variable
From here I have tried everything I could find but nothing worked
Simply adding both variables in the EDIT issue fields as smart values.
i.e. {{varNextRelease}} , {{varCurrentFixVersions}} NO GO But selecting 2 other named releases/versions works fine
I have tried custom JSON NO GO But no errors in audit log AND both variables have exactly what I want. This just clears the fixVersion field; whether I use ADD or SET, makes no difference.
If I reverse the field order, I end up with just the varNextRelease
{"fields": {"fixVersions": [{"add": {"name": "{{{varCurrentFixVersions}},{{varNextRelease}}"}}]}}
I have gone to some AI and all I got was the same things I found, none worked.
I find it hard to believe that something so simple, as appending rather then replacing could be this difficult. Manually it is simple. Doing bulk updates, it is simple.
I have to just be missing something ... simple.
First thing: if the version update with Edit Issue is taking so long it requires multiple Re-fetch Issue actions to succeed, you may want to use another method (i.e., the REST API call). One of those re-fetches should have been enough for this type of update.
Moving on with what you have started already...
In this case, you are trying to set the field and not use "add" with JSON. Thus the syntax will be this, as Jack first described:
{ "fields": { "fixVersions": [ { "name": "version1" }, { "name": "version2" } ] }}
Thus the key is how to merge those entries in the variables...
First, when saving the current versions, I recommend taking complete control of the delimiters to avoid surprises:
Now concatenate on the new one with this:
{{varCurrentFixVersions.concat(",").concat(varNextRelease)}}
That is now a comma-separated values list of version names. You may want to consider a condition check in case the field had no existing version values.
Finally, that expression can be split() into a list to dynamically generate the JSON for the update:
{ "fields": { "fixVersions": [ {{#varCurrentFixVersions.concat(",").concat(varNextRelease).split(",").distinct}} { "name": "{{.}}" } {{^last}}, {{/}} {{/}} ] }}
That {{^last}}, {{/}} part conditionally adds the trailing comma so the JSON parsing does not fail.
It looks like you're new here. Sign in or register to get started.