Dropdown lists can be used for fields that should be populated with one of a predetermined list of values. Using dropdown lists will result in increased control of your data, reducing data redundancy and improving the integrity of your database. Dropdown fields make it easier to sort and report in Sugar because they prevent misspellings and word variations that may disrupt the natural order of your data. This article covers how to create a new dropdown field and define its list of values.
You must be an admin user or have developer-level role access in order to create dropdown fields and lists via Admin > Studio.
In this example, we will be creating a dropdown field named “Region” in the Accounts module that will give users a list of geographical regions to choose from. This article offers basic steps for creating fields; for more detailed information on creating fields, please refer to the Studio documentation.
Before you can add a dropdown field to Sugar, you must prepare a list of values for it to use. The following sections cover creating the list of values and then creating the new field that will reference the dropdown list.
A dropdown list may be used and re-used in many different fields in Sugar. For example, a list of regions may be used for a field in the Accounts module and for another field in the Quotes module.
Use the following steps to create a list of values that we will use when creating the dropdown field in the next section.
- Navigate to Admin > Dropdown Editor, which is located within the Developer Tools panel.
- Click on the Add Dropdown button.
- In the Name field, you will see “_list”. Add a descriptive name for this list in front of the underscore. For this example, our list’s name will be regions_list.
- Enter the Item Name and Display Label for each of the field values this list should contain, clicking “Add” after entering each one.
- The Item Name is stored in the database and the Display Label is what the users will see.
- These two values are often the same but do not have to be.
- Order the values as you want to display to the user.
- To add a blank value to the list, simply click the Add button without entering anything for the Item Name and Display Label fields.
- The default list value will be set when creating the dropdown field in the next section.
- Click Save to preserve the list values and order.
After defining the values in the list, create the field that will display the dropdown list.
- Navigate to Admin > Studio. If you have just completed the steps above, you can click the Studio button at the bottom of the page.
- Select Accounts > Fields > Add Field.
- Create a new field as follows:
- Field Type : DropDown
- Field Name : region
- Display Label : Region
- Drop Down List : regions_list
- Default Value : Select the list item that should be displayed by default. This is often a blank value, which is what we will select for the current example.
- Reportable : Yes (checked)
- After completing any other optional field properties, click the Save button to create the new field.
Now that you have a dropdown field created, add it to the record view, list view, search, and the mobile layouts for the Accounts module.