Hello! I am trying to add fix versions to the parent/epic from the trigger issue. My trigger is when the fix version value changes on a story/bug/task. I have a branch to check that a parent exists and then to modify the parent using the JSON below:
{
"update": {
"fixVersions" : [
{
"add": {
"name":"{{triggerIssue.fixVersions.name}}"
}
}
]
}
}
I have referenced many other articles and resources such as https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/ but I think somewhere I am missing a step. My audit log sjhows that its hitting an error when it tries to edit the parent: (Specify a valid value for fixVersions (fixVersions)).
Hello @Toni Duer
Is your Parent epic in the same project as trigger issue?
Hello,
If your trigger issue has more than 1 fixVersion, then we have to format the JSON..
Before Branch,
Create a variable, call it myvar assign it {{#issue.fixVersions}}{{name}}{{^last}},{{/}}{{/}} [see screenshot]
Then in your advanced edit, use below smart value:
{ "update": { "fixVersions": [ {{#myvar.split(",")}}{ "add": {"name" : "{{.}}" }}{{^last}}, {{/}}{{/}} ] } }
Basically, above syntax will render the JSON like below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I added the new variable. Do I need to reference the new variable in my JSON later when I edit issue fields or will that stay the same?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When editing the field, your JSON should be like below, replace bolded part with your variable name.
{ "update": { "fixVersions": [ {{#myvar.split(",")}}{ "add": {"name" : "{{.}}" }}{{^last}}, {{/}}{{/}} ] } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much! It works! Is there a "remove" function that works similar to "add" in the JSON for when a fix version is removed instead of added?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great.
If you want to implement to add or remove logic.. your rule needs more steps.
Basically,
{{changelog.Fix Version.fromString}} <-- Gives you items removed
{{changelog.Fix Version.toString}} <-- Gives you items added
Then, {{changelog.Fix Version.fromString.size}} gives you items were removed or not, same with {{changelog.Fix Version.toString.size}}
So you implement if conditions first to determine if items were removed and/or added. (see screenshot further below)
Inside each if condition, you will implement same rule we mentioned, with few changes on where to get the added / deleted values.
To add fixversions,
Inside if condition, you create variable (myvar) and assign it below smart value:
{{#changelog.Fix Version}}{{fromString}}{{^last}}, {{/}]{{/}}
Then edit issue with below JSON:
{ "update": { "fixVersions": [ {{#myvar.split(",")}}{ "add": {"name" : "{{.}}" }}{{^last}}, {{/}}{{/}} ] } }
To remove fixversions,
Inside if condition, you create variable (myvar) and assign it below smart value:
{{#changelog.Fix Version}}{{toString}}{{^last}}, {{/}]{{/}}
Then edit issue with below JSON:
{ "update": { "fixVersions": [ {{#myvar.split(",")}}{ "remove": {"name" : "{{.}}" }}{{^last}}, {{/}}{{/}} ] } }
Hope it helps and if you think your answer was resolved, please consider accepting solution so others can benefit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you @Kalyan Sattaluri
this helped me a lot after I tried to use {{triggerIssue.fixVersions.name}} (which gave me the all Versions as one combined String and {{#triggerIssue.fixVersions.name}} (which just throws an Error).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Toni Duer and @Kalyan Sattaluri
Please note the {{fromString}} and {{toString}} values for the changelog of Fix Versions could overlap in values, and...
There could be inconsistencies due to this known defect for changelog accuracy of list fields such as Fix Versions and Sprints: https://jira.atlassian.com/browse/JRACLOUD-80486 This defect is worsened as apparently not all of the UX paths to change / create Fix Versions are tracked in the changelog.
At this time, there is no known work-around for this defect. The severity and priority were recently increased, so perhaps this will be finally fixed.
For a mitigation, you may try:
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh wow. Thanks @Bill Sheboy Went and checked and {{changelog.Fix Version.toString}} is definately broken and {{changelog.Fix Version.fromString}} "seems" to be working but I havent checked thoroughly. Thank you and will be mindful go forward.
@Apologies @Toni Duer given this news, may have to rethink if you want to handle removes or just sync child stories to parents.. Cause blanket syncing which you have already/first implemented should be working. Just this nuanced pick and choose part seems to be broken from Jira..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Join the largest European gathering of the Atlassian Community and reimagine what’s possible when great teams and transformative technology come together. Plus, grab your Super Fan ticket now and save over €1,000 on your pass before prices rise on 3 June.
Register nowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.