Forums

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

Anyone had any luck changing the custom field type from single-line text to multi-line tex in jira7?

Martin Poirier
Contributor
May 1, 2018

The method used to change a custom field type from single to multi line doesn't seem to work in Jira 7. (tried in jira 7.2 and 7.7). Anyone know what the problem could be?

Here's what I did:

https://confluence.atlassian.com/jirakb/changing-custom-field-types-in-jira-158357.html?_ga=2.22600379.1435687155.1525088955-1375983188.1500658785

Steps to reproduce:

  1. Pick any single-line text field in the Jira database (CUSTOMFIELDTYPEKEY = "com.atlassian.jira.plugin.system.customfieldtypes:textfield")
  2. Change the CUSTOMFIELDTYPEKEY value to "com.atlassian.jira.plugin.system.customfieldtypes:textarea". The searcher is the same for both text field types, but the documentation mentions changing it to textsearcher.
    UPDATE customfield SET CUSTOMFIELDTYPEKEY='com.atlassian.jira.plugin.system.customfieldtypes:textarea', CUSTOMFIELDSEARCHERKEY='com.atlassian.jira.plugin.system.customfieldtypes:textsearcher'
    where cfname='Text Field';
  3. Clear the Jira internal cache (by using ScriptRunner's builtin function) OR restart Jira
  4. Consult existing issues with values in the field you changed

 

Expected Results: 

  • The custom field shows the values correctly in the text box.

 

Actual Results:

  • The value is not displayed in the field. Only an empty text box is shown, regardless of the renderer used (default or wiki)
  • If the project is reindexed, the values for that field are removed from the index, breaking JQL searches
  • Note that the values are still in the database. Reverting the custom field type in the database and clearing the cache will bring back the values in the original single-line text field.
  • There are no errors in atlassian-jira.log related to the custom field

 

2 answers

1 accepted

0 votes
Answer accepted
Martin Poirier
Contributor
May 2, 2018

Ok, so I ended up fixing my issue by setting the STRINGVALUE from the single-line field to TEXTVALUE used in the textarea

update customfieldvalue
set TEXTVALUE = STRINGVALUE
where customfield = [customfieldID]
and TEXTVALUE is null;

I cleared the internal cache and it worked out fine. It's easily reversible in any case.

Thanks for your input

1 vote
Ivan Tovbin
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.
May 1, 2018

I usually advise users to NEVER touch Jira DB.

That said, if I had to do something like this, I'd create a new multi-line text field and then use a groovy script to copy the value from the old field to the new one in all required issues. After that's done, I'd simply delete the old field. 

The same approach can be used to update all saved filters if needed.

Martin Poirier
Contributor
May 1, 2018

We do touch the DB all the time. It's safe enough when you know what you're doing, and since that change comes from Atlassian's KB, it should be working. It works fine on jira 6.

The thing is, we can't delete the old field, since it's used in automated tools. If its ID changes, we'd need a lot of people to reconfigure some of their tools, which we'd really want to avoid.

It really seems like a bug, but I was wondering if it could be worked around.

Nic Brough -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.
May 1, 2018

So you're taking Jira offline "all the time"?

That change does indeed work for 6, but the latest version doesn't support it due to changes in the way text fields are being held.

Martin Poirier
Contributor
May 2, 2018

Hi Nic,

Thanks for the answer. And no, we don't take JIRA offline all the time, we clear the cache :)

Nic Brough -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.
May 2, 2018

Clearing the cache is not good enough in most cases, so I hope your changes are limited to the places where it is good enough (i.e. not issue or project data)

Suggest an answer

Log in or Sign up to answer