
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2022 06:12 AM
In the past, I have heard from a couple developers that we should not use use Choice type fields when using them with Yes/No choices and instead use checkboxes. The reason is that boolean takes up less space in the database.
Are there any best practices around these field types and when to use them?
Solved! Go to Solution.
- Labels:
-
Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2022 08:29 AM
My main reason for using a "Yes/No" choice field over a checkbox is when I want to force someone to select an answer, i.e. make the field mandatory. Checkbox fields do not function well under this use case as either state fulfills the mandatory requirement, but a choice list with "Yes", "No" and a null item forces the user to select an answer.
As for "less space in the database", technically yes, but that shouldn't be a concern. Think of the user experience first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2022 06:23 AM
Hi
When you have a definite answer which is in the form of "Yes/No" or "True/False" then go with using Boolean field type and where you have more choices or you want to name the labels , then go with Choices.
Now to understand the best practices of using Choice refer to this article: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0538947
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2022 08:17 AM
Thank you for your reply.
Is it true that the Yes/No choices would take up more storage in the database than the boolean checkbox?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2022 08:29 AM
My main reason for using a "Yes/No" choice field over a checkbox is when I want to force someone to select an answer, i.e. make the field mandatory. Checkbox fields do not function well under this use case as either state fulfills the mandatory requirement, but a choice list with "Yes", "No" and a null item forces the user to select an answer.
As for "less space in the database", technically yes, but that shouldn't be a concern. Think of the user experience first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2022 01:03 PM