Forums

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

Rewrite Filters automatically when Renaming Custom Fields

Mike Bertelsen January 29, 2012

If we rename a custom field its expected that gadgets using those fields will need to be edited.

We found this to be the case when we edited a value of a field. Gadgets failed and needed thier JQLs to be edited to pick up the changes.

How do we determine the impact (of renaming fields) to existing gadgets and JQL queries?

Please response ASAP!

We are currently at JIRA (v4.1#519)

6 answers

1 accepted

0 votes
Answer accepted
Mike Bertelsen February 5, 2012

We provided end users with a Job Aid on how to edit filters using the UI and then renamed the fields.

I really do appreciate all the feedback and advice. It helped to determine the best way to deal with this issue.

2 votes
tier-0 grump
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 30, 2012

As already commented, the problem is that the filters store their query string, and this typically uses the name of the custom field. When JIRA executes this query it always looks for ID, so it does a transforemation from name to string. Perhaps the best advice is to always use customfield ids in queries, so use the form customfield_10021, and then you are impervious to renames.

You can find out what existing queries are using the custom field by examing the DB - issue something like

select filtername from searchrequest where reqcontent like %field name%

As Jobin has pointed out, this may not give you the right answers as you can have many custom fields with the same name.

I'm also not 100% convinced that like always matches substrings in all databases, for instance you may have a filter with a saved query like summary ~ important and mycustomfieldname = fred, but I think it does :-)

Incidentally, this renaming facility is what caused me the most heartache when I was coding up the search change history feature - how to deal with renames...

Mike Bertelsen January 30, 2012

My mistake on using OnDemand. Wasn't thinking clearly. I will try out your suggestion in the morning.

tier-0 grump
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 30, 2012

And of course, I see you're in On Demand, so you have no access to the database - so my advice would be to do a backup to XML, and then do a free text search in this. YOur XML will have entries lik this for filters

<SearchRequest id="10000" name="All" author="admin" user="admin" request="ORDER BY key DESC" favCount="1"/>

You can see the filter name in the name attribute and the filter query in the request attribute

1 vote
JamieA
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 29, 2012

This surprises me... you'd think internally the filter would be stored with the ID of the custom field, but it's not...

0 votes
James Rickards (Personal) May 17, 2016

Vote for this Suggestion if you want this functionality in jira.

https://jira.atlassian.com/browse/JRA-61048

0 votes
JamieA
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 30, 2012

You can't reliably fix it given that cf names are not unique, but it should be possible to store a canonical version of the query, but display it in a more human-readable way...

It's also possible to visit every clause in every query, and change the names there. I did that for my script for renaming a user, and it was extremely painful. But fun.

0 votes
Jobin Kuruvilla [Adaptavist]
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 29, 2012

Well, that is not possible technically because you can have more than one custom field with the same name :) I think the only sane way is to use the ids in the JQL queries and filters but that needs a rewrite of all the existing ones.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events