Requirements for new fields
Before you create a new field, determine the characteristics of the field and the object types that will use the new field.
The following list identifies information that is needed before you create a new field:
- Object - Identify the object types where the new field will be added. Decide which object to use first. You can add the field to other object types later.
- Field group - Should the field be added to an existing field group or do you need a new field group? Consider categorizing collections of field definitions in the same field group for ease of maintenance.
- Name - How will the new field be identified? The name is important because it is also the default label that appears next to the field. Special characters cannot be used. For more information, see Field naming guidelines.
- Label - What text do you want to display next to the field when this field appears in a view? Add a label to give the field a more meaningful name for users. You can also add labels for different locales. When a user opens a view that contains the field, for example, the translated label is what they see. For more information, see Localizing text). If you don't add a label, the field name is displayed.
- Data type - What is the type of data, such as Boolean or Date, that is captured by the field? For some data types, for example, Simple String, you can also specify a Display Type. The display type determines how the field is presented to the user. For more information, see Data types.
- Required? - Is the user required to enter data in this field or is data entry optional? Is data entry always required or is it required only in certain contexts? When a field is set to Required, the setting applies to the field no matter where it is displayed. If you want the field to be required only in certain contexts, set the field to Required in the view definition or within field dependencies instead. For more information, see Making fields required or optional.
- Global search - If you use global search, do you want this field to be indexed and used for global search?
- Encrypted - If the field is defined as a simple string or long string data type, decide whether the field values should be further secured by using encryption. For more information, see Encrypting field values.
- Default value - Depending on the data type of the field, you can specify a default value. Do you want to set a default value for the field or do you want it blank? The default value is used when a new object instance is created. If you change the default value for a field, existing object instances are not updated.
Example
Suppose you want to add an Owner field to several object types. You can either create an Owner field and add it to the field group for each object type, or you can create a generic Owner field and field group for all object types and reuse it later if you want to add it to other object types.
To simplify the work, follow the generic approach and create a generic field group and field that can be added to any object type.
Plan the design of the new field:
- The new field needs a field group and a generic name. Name the field group Custom Fields and name the field Owner. The field label is important because it is the text that appears next to the field in the application, for example in views. You can provide different labels for different locales. For more information, see Localizing text.
- The Owner field will be used to capture a name, so the data type for this field will be User/Group.
- Suppose you want objects to have only one owner. In this case, the display type for the field will be User Selector.
- Since the Owner field is considered important, make it a required field so that users must enter a name into the field before they can save and exit the page.
- The User/Group data type doesn't support a default value. The initial value of the field will be blank.
- There are no other fields to be added to the Custom Fields field group. The Owner field is the only one you need for this example.
Now that you've planned the design, you're ready to create the new field and add it object types.