Sub topic 2
Standard and Custom Fields
Assume you know the Salesforce UI, Setup, and basic relational data terms such as tables, rows, and foreign keys.
Standard and Custom Fields
A field stores one value on a record. Standard fields are provided by Salesforce, such as Account.Name, Contact.Email, and Opportunity.Amount. Custom fields are fields that an administrator or developer adds for a business requirement.
Custom field API names end in __c. Their labels can be changed for users, but code uses the API name. For example, a field labeled “Credit Limit” might have the API name Credit_Limit__c. Field types control the allowed values, such as text, number, date, checkbox, picklist, or lookup.
| Field kind | Example API name | Typical use |
|---|---|---|
| Standard | `Industry` | Salesforce-provided account classification |
| Custom | `Credit_Limit__c` | Organization-specific account data |
SELECT Name, Industry, Credit_Limit__c
FROM Account
WHERE Industry = 'Technology'
LIMIT 10Lookup, Master-Detail, and Many-to-Many Relationships
A relationship connects records from different objects.
- A lookup relationship is a flexible reference. The child can usually exist without a parent, and ownership and sharing remain separate.
- A master-detail relationship tightly connects the child to the parent. The child inherits ownership and sharing, and deleting the parent can delete its detail records.
- A many-to-many relationship uses a junction object with two relationship fields. For example,
Course_Enrollment__ccould connect students and courses.
Custom relationship fields usually end in __c. In SOQL, the parent relationship name commonly ends in __r, as in Account__r.Name.
Extend a Standard Object or Build a Custom One
Extend a standard object when the data describes that standard record. Add custom fields, layouts, automation, or relationships to Account, Case, or another suitable object.
Build a custom object when the data has its own lifecycle, permissions, reporting needs, and relationships. For example, invoices may relate to accounts but require independent status, numbering, and approval fields. Reusing a standard object only to avoid creating one can make its meaning unclear.
Exercise
Which relationship should you choose for a child record that must inherit its parent’s sharing and cannot exist independently?
Show answer
Choose a master-detail relationship.