Data Model and Database Design
What to know
ServiceNow models data as tables containing records containing fields. A table is defined in sys_db_object; its columns are defined in sys_dictionary. Every record has a unique 32-character sys_id, a number (from a number sequence) if enabled, and standard audit fields such as sys_created_on and sys_updated_by.
Understand column types and choose deliberately: string, integer, choice, reference, glide_list, date/time, and journal. Choices live in sys_choice and store a value plus a label; reference fields store the sys_id of a record on another table. A dependent field (for example Subcategory on Category) requires its controlling field to supply matching choice values.
Understand table extension vs reference. Extension creates an is-a relationship: Incident extends Task, inheriting every Task column and business rule, and adding an inherited-only view. You cannot delete an inherited column from the child. Reference creates a has-a relationship where the target records exist independently.
Many-to-many relationships use an intermediate m2m table (for example sys_user_grmember). Add database indexes on columns used in frequent query filters, and use coalesce fields on transform maps to prevent duplicate inserts.
Traps
- Deleting a column deletes its data permanently, and deleting a column inherited from a parent is not allowed.
- Confusing choice values with labels; filters and scripts compare against the value.
- Assuming a reference field displays the sys_id rather than the target table's display value.
- Extending a table to reuse one field, then inheriting an entire rule set you did not expect.
Worked example
Need to store a customer contact on a case? Use a reference to sys_user, not a free-text name. Need a new record type that shares state, assignment, and work notes with Task? Extend Task.
Rule of thumb: is-a means extend; has-a means reference.