- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-10-2018 06:42 AM
Hi,
Can anyone please suggest, how can we convert field type of Checkbox to Dropdown(choice list) with choices as Yes No?
I want to change existing field type only as new field creation will cause field name change and will impact scripts where this field is used(Have many fields to make same change)
Thanks in advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-10-2018 06:58 AM
As Ashutosh noted, you need to create a new field or you will have data issues. You may not even be able to convert a True/false to a choice list. The system restricts certain types of data type changes.
If you want the field name to be the same, then I recommend the following approach.
- Create a new choice field ex: u_choice1 and populate it with Yes/No values
- Use a script to copy your true values to Yes, and false values to no from the old field (u_bool) to the new field (raise your hand if you need help with this part
- Delete the old field (u_bool)
- Create a new u_bool field of type choice
- Use another script to copy field values from u_choice1 to u_bool
- Delete u_choice1
Now you have a u_bool field of type choice with the true/false values as yes/no values.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-17-2020 09:15 AM
Hi Chuck
How do I do that:
2. Use a script to copy your true values to Yes, and false values to no from the old field (u_bool) to the new field (raise your hand if you need help with this part

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-06-2019 12:16 PM
Hello-can you provide some guidance with the Script creation--"Use a script to copy your true values to Yes, and false values to no from the old field (u_bool) to the new field" thanks much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā05-08-2020 10:41 AM
There are probably more clever ways to do this, but this seems to work (after you make the necessary changes):
var NAME = 'Fix Script Example: ';
try {
gs.log(NAME + 'Starting processing');
var gr = new GlideRecord('some-table');
gr.addNotNullQuery('from_tf_field');
gr.query();
var row_count = gr.getRowCount();
var count = 1;
while (gr._next()) {
if (gr.from_tf_field) {
gr.u_to_yn_field = 'yes';
}
else {
gr.u_to_yn_field = 'no';
}
gr.update();
if (count % 1000 == 0) {
gs.log(NAME + 'Updated ' + count + ' records out of ' + row_count);
}
++count;
}
}
catch (err) {
gs.error(NAME + err);
}
finally {
gs.log(NAME + 'End processing');
}