How can I remove a specific fixverion from a ticket with an automated rule

Annie Kearns January 8, 2025

Hey! 

I have 2x automated rules setup in Jira that will be applied around release processes. 

The process is: 

When a ticket moves from the status 'In QA' --> 'Dev Complete', the ticket is added to the fix version 'vNext' 

The vNext fix version in Jira is used as the 'parking lot' for tickets that are ready to be planned into the next release. During release planning, the team will manually add a new fixversion to each ticket, to specify the release # and date etc. 

My rule created to add tickets from 'In QA' --> 'Dev Complete' works fine, and tickets are added to vNext as expected: 

jira rule 1.png

Rule 2 

I have a second rule where I'd like the fix version 'vNext' to be removed as a fixversion once the ticket moves further down the release process/workflow. This is so the vNext queue doesn't get clogged with tickets that are already in the release process/workflow, and we only see tickets in the vNext fixversion that are ready to be planned into the next release. 

However, rule 2 I have setup is clearing ALL fix versions from the ticket upon status change. However, I only want to remove the specific fixversion: vNext 

This how rule 2 has been setup: 

jira rule 2.png

And the JSON included in this rule is: 

rule 3.png

{ "name": "Remove Fix Version vNext", "enabled": true, "projectKey": "SFCC", "trigger": { "event": "jira.issue.updated", "conditions": [ { "field": "fixVersion", "operator": "contains", "value": "vNext" } ] }, "actions": [ { "action": "edit", "field": "fixVersion", "operation": "remove", "value": "vNext" } ] }

I admit I asked chatgpt for this JSON as I was struggling! 

Please could I get some direction with Rule 2, so I'm retaining the new fixversion manually added, and only removing vNext 

Thanks! 

1 answer

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2025

Hello @Annie Kearns 

The reason the field is getting cleared is because you are trying to update it in two ways in the Edit Action; with JSON in More Options, and by having selected it as a field from the Choose Fields list.

Screenshot 2025-01-08 at 8.30.46 AM.png

Having selected the field in the above manner and leaving the value portion empty tells Jira to clear the field.

Pull down the Choose Fields list and deselect the Fix Versions field. Then only the JSON will be used to try to change the field.

 

Note: I have not reviewed the JSON code specifically, but I know the above is at least one problem with your rule.

Annie Kearns January 8, 2025

Hey Trudy! 

Thanks for your reply :) 

That makes sense also, thank you. I've removed the selected fixversion field and saved the change and done a test, however, vNext is not being removed from the fixversion when I change the ticket status. 

The rule is currently setup like the below with just the JSON applying and no field selected at the top.

jira rules vnext.png

Maybe it could be the JSON? 

Thanks!

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2025

Just to confirm, this is what you have in the JSON field?

rule 3.png

If so, that is totally wrong.

The reference for advanced editing with JSON can be found here:

https://support.atlassian.com/cloud-automation/docs/advanced-field-editing-using-json/

For this specific case I found an example in a response in this post.

Replace all the JSON you have with this:

 

{ 
"update": {
"fixVersions": [
{"remove": {"name":"vNext"}}
]
}
}

 

Like Bill Sheboy likes 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.
January 8, 2025

Hi @Annie Kearns 

Adding to Trudy's suggestions, your JSON is incorrect for removing that value from the Fix Versions field.

Please try this, adding a condition before the edit to confirm the value is present:

{
"update": {
"fixVersions": [
{
"remove": { "name": "vNext" }
}
]
}
}

The condition before the edit helps ensure that a person has not already manually removed the value.

 

As another alternative, you could use smart value, list filtering to extract the other values and set the field to the remainder.  (Although, this will unnecessarily edit the field when not needed.)

 

Kind regards,
Bill

Like Trudy Claspill likes this
Annie Kearns January 8, 2025

Hi Bill, 

Thanks so much that's worked a charm :) 

That's what I get for asking chatgpt for JSON ;) 

Tested and all working as expected 

Thanks again

Annie 

Like # people like 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.
January 8, 2025

Awesome; I am glad to learn Trudy and my suggestions helped!

And...in my opinion, one large challenge using any bot-generated suggestions for Atlassian tooling, questions is missing context

A bot cannot see your site configuration and is often "guessing the next word" using data from web-crawling and other questionably-acquired sources.  Thus it parses "JSON" in our question prompt and uses someone's interpretation of what that indicates.  It does not go to the documentation source I provided, check the metadata schema for Atlassian automation use of JSON for your specific issue type, etc.

Even though it takes time and effort, my recommendation is reading and experimentation within your site.  :^)

 

Like Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events