Developer 1 - Objects
These notes were taken while studying using Mike Wheeler's Salesforce Courses.
25 - Introduction to Objects
- Object-Oriented Programming: programming methodology that is widely accepted as one of the most efficient ways to code.
- Term “Object” is unfortunately kind of ambiguous in Salesforce:
- Salesforce Objects:
- Accounts, Contacts, Custom Objects, etc
- Built declaratively with clicks
- Used to organize the data we store in Salesforce
- Apex-Developed Objects:
- Built in Apex and used only in a programmatic context
- Used to organize reusable methods and variables
- Apex objects aren’t used to store data like Salesforce Objects are - just used to better organize code
- Salesforce Objects:
- Term “Object” is unfortunately kind of ambiguous in Salesforce:
- Example problem:
- A company wants all their Account Names to be pre-pended with “ABC -”. Example: “AVC - Complex Storage”
- When a user tries to save an Account that doesn’t follow this format, an error should be thrown
- In the real world, this would be done with a validation rule. For purposes of this course, we will do it with Apex and implement the solution using object-oriented principles.