Record types
Give different kinds of record in one module their own form, layout, field settings and rules, based on the value of a choice field.
- Who can use this
- Account owner, Manager
Give different kinds of record in one module their own form, layout, field settings and rules, based on the value of a choice field.
Record types let one module hold different kinds of record, each with its own form. A Deals module, for example, can have New business and Renewal deals: each type gets its own layout, its own required or hidden fields and its own rules. The type of a record is the value of one choice field. Admin screens call modules entities; this page says module.
Open Sidebar → Admin → Entity Manager, click the module, then the Record Types tab.
Under "Select an enum field to use as the record type discriminator", pick the choice field. The tab then shows it in a Discriminator: badge and lists the record types.
The New Record Type dialog opens.
Under <type field> value, choose the value of the type field this type applies to. Then set Label (required, filled in from the option), and if you like Description, Icon, Color and Sort Order (the order in which types are offered). Switch on Default type for the type that records with no value get, and leave Enabled on.
You see "Record type created" (or "Record type updated" when you edit one) and the type appears as a card in the list. Repeat for the other values. Add Type is greyed out once every value of the field has a type; add an option to the field to add another.
Open Field Overrides on a type. For each field, set Visible, Required and Read Only for this type. Leave a box unchecked to inherit from the field definition. Click Save Overrides ("Field overrides saved").
When someone creates a record, they first see "Select a type to continue" with the enabled types in Sort Order. The form then uses that type's layout and its default values. Changing the type of an existing record is the same as changing the type field: the new type's settings apply from then on. A field that is read-only for the old or the new type cannot be changed in the same save that switches the type.
| Message or symptom | Why | What to do |
|---|---|---|
| "<name>" is not a value of the "<field>" field. / Record type name "<name>" (did you mean "<Name>"?) must match a value of the "<field>" field | A type's value must be one of the type field's values, written exactly | Pick the value from the list, with the same capitals |
| A record type named "<name>" already exists on <module>. | That value already has a type | Edit the existing type |
| "<Label>" is read-only for <Type> records | The type's field overrides make the field read-only | Ask an admin to change the type's Field Overrides |
| Badge Never applies | No value of the type field equals the type's value | Change the type's value or add the option to the field |
| "No enum fields found. Create an enum field first." | Record types need a choice field | Add a choice field first |