How to change a custom field type ?

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2011

Hi All

I need to change one of my custom fields from 'Text Field' tp 'Free Text'.

Please let me know your suggestions.

Thanks

Vishnu.

2 answers

1 accepted

0 votes
Answer accepted
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.
September 25, 2011

As a possibly safer alternative to the above, you can try the copy custom field values function from the script runner plugin. So you could copy Ref Testcase to "Ref testcase new", verify everything looks OK, delete "Ref Testcase", then rename Ref Testcase New to Ref Testcase.

Advantage of this is that you don't need downtime to do it.

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 26, 2011

Thanks Jamie.

Sounds good. But is it possible to move values from one field to another using Jelly Runner ?

I do not prefer installing plugins.

Please offer your opinions.

Thanks, Vishnu.

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.
September 26, 2011

In theory it's possible with jelly runner, in practice not so much, not unless someone has already written how.

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2011

Thanks Deepnight,

I already got this.

"UPDATE customfieldvalue SET textvalue=stringvalue WHERE ID=(SELECT ID FROM customfield WHERE

customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:textfield' AND cfname='Text Field');"
I guess If I try this, all of my 'Text Fields' will be changed to 'Free Text'. My requirement is to change only one of my custom field called 'Ref. Case'.
Any suggestions ?
Regards
Vishnu.
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.
September 25, 2011

No, that SQL is correct - note the use of the "cfname" in the selection, you need to replace 'Text Field' with the actual name of your custom field that you want to change.

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 25, 2011

Thanks to Both. You are right !!!

I faced another problem. I ran the following queries.

1. 1. UPDATE customfieldvalue SET textvalue=stringvalue WHERE ID=(SELECT ID FROM customfield WHERE
customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:textfield' AND cfname='Ref. Testcase');

2. UPDATE customfield SET CUSTOMFIELDTYPEKEY='com.atlassian.jira.plugin.system.customfieldtypes:textarea', CUSTOMFIELDSEARCHERKEY='com.atlassian.jira.plugin.system.customfieldtypes:textsearcher'
where cfname='Ref. Testcase';

The first one didn't change anything as The table ' customfieldvalue' doesn't have an entry for this field.

I avoided this and ran the second one which changed the field type. Restarted the JIRA, I lost values in this field of all issues. But the type has been chaged.

I guess the problem was I haven't changes the values to 'stringvalue'.

Do we have ant other table which keeps this liek 'customfieldvalue' ? This is JIRA 4.0.1.

Regards

Vishnu.

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.
September 25, 2011

Er, no, the table customfieldvalue IS where the data is kept. If you're saying you didn't find any in there, then you didn't have any data to change.

Jaan Raamets
Contributor
September 25, 2011

I fear the documentation is wrong (at least for jira 4.4). IMO instead of

{code}

UPDATE customfieldvalue SET textvalue=stringvalue WHERE ID=(SELECT ID FROM customfield WHERE

customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:textfield' AND cfname='Text Field');
{code}

It should be

{code}

UPDATE customfieldvalue SET textvalue=stringvalue WHERE CUSTOMFIELD=(SELECT ID FROM customfield WHERE

customfieldtypekey='com.atlassian.jira.plugin.system.customfieldtypes:textfield' AND cfname='Text Field');
{code}
note the part "WHERE CUSTOMFIELD=(SELECT ID".

Try simple select and see if its really so.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events