Salesforce Data Model Basics
- Objects:
- Definition: Objects in Salesforce are similar to tables in a database. They store specific types of data.
- These are pre-built objects provided by Salesforce.
- Examples:
- Account: Represents a company
- Contact: Represents an individual
- Opportunity: Represents a potential sale
- These are objects you create to store information unique to your organization.
- Example: Let’s say you’re a real estate company. You might create a custom object called “Property” to store information about houses for sale.
- Fields:
- Definition: Fields are like columns in a database table. They store specific pieces of information within an object.
- Pre-built fields that come with standard objects.
- Example: The Account object has standard fields like “Account Name”, “Phone”, and “Billing Address”.
- Fields you create to capture additional information.
- Examples:
- Text: For storing short text, like a property’s street name.
- Number: For numeric values, like the number of bedrooms in a property.
- Date: For storing dates, like when a property was listed.
- Picklist: For predefined options, like property types (Apartment, House, Condo).
- Relationships:
- Definition: Relationships define how objects are connected to each other.
- A loose connection between two objects.
- Example: A custom object “Property” might have a lookup relationship to the standard “Account” object to represent which real estate agency is selling the property.
- A tighter connection where the master object controls certain behaviors of the detail object.
- Example: If you have a custom object “Room” to track individual rooms in a property, you might create a master-detail relationship between “Property” (master) and “Room” (detail).
When thinking about how to solve problems related to the data model, consider these steps:
- Identify the business need: What information needs to be tracked?
- Determine if existing objects can meet the need or if a new custom object is required.
- Identify what fields are needed to capture all necessary information.
- Consider how this new data should relate to existing data in your org.
Example Problem: Your real estate company wants to start tracking property viewings.
Solution Approach:
- Create a custom object called “Property Viewing”.
- Add custom fields:
- Date/Time field for when the viewing is scheduled
- Picklist field for the status (Scheduled, Completed, Cancelled)
- Text area for feedback from the potential buyer
- Create relationships:
- Lookup to the Property object (which property is being viewed)
- Lookup to the Contact object (who is viewing the property)
- Lookup to the User object (which agent is conducting the viewing)
This approach allows you to track all property viewings, link them to specific properties and potential buyers, and record the outcome of each viewing.
Salesforce User Management
User Management:
a) Profiles:
- Definition: Profiles define the base-level permissions for users, including object permissions, field permissions, and user permissions.
Examples:
- Standard Profile: “Standard User” – basic access to most objects.
- Custom Profile: “Sales Manager” – access to all sales objects, ability to manage other users’ records.
b) Roles:
- Definition: Roles primarily control record access through the role hierarchy.
Example: Consider a sales organization:
- CEO (top of hierarchy)
- VP Sales
- Sales Manager
- Sales Rep
- Sales Manager
- VP Sales
In this hierarchy, a Sales Manager would be able to see and edit their own records as well as those of the Sales Reps below them.
c) Permission Sets:
- Definition: Permission Sets grant additional permissions to users beyond what’s in their profile.
Example:
- Custom Permission Set: “Advanced Analytics User” – grants access to Einstein Analytics for select users across different profiles.
Problem-solving approach for User Management:
Set up the role hierarchy to mirror your organization’s structure for record sharing.
Start with the principle of least privilege: give users only the access they need.
Use profiles for base-level access that applies to groups of users.
Use permission sets to grant additional access to specific users without changing their profiles.
Salesforce Security Model
a) Org-wide Defaults (OWD):
- Definition: The baseline level of access users have to records they don’t own.
Examples:
- Private: Users can only see and edit their own records.
- Public Read Only: Users can see all records but only edit their own.
- Public Read/Write: Users can see and edit all records.
b) Sharing Rules:
- Definition: Automatically share records with users or groups based on record owner or other criteria.
Examples:
- Criteria-Based: Share all high-value opportunities (Amount > $1M) with the executive team.
- Ownership-Based: Share all accounts owned by the EMEA sales team with the EMEA support team.
c) Role Hierarchy:
- Works in conjunction with OWD and sharing rules.
- Users higher in the role hierarchy can see and edit records owned by users below them in the hierarchy.
d) Manual Sharing:
- Users with the ability to manage record sharing can manually share individual records with other users or groups.
Problem-solving approach for Security:
- Start by setting Org-wide Defaults to the most restrictive setting that still allows users to do their jobs.
- Use the role hierarchy to open up vertical access (managers seeing their subordinates’ records).
- Implement sharing rules for exceptions where groups of users need access to records they don’t own.
- Use manual sharing as a last resort for one-off situations.
Salesforce Automation Tools
a) Workflow Rules:
- Definition: Automate simple field updates, email alerts, tasks, or outbound messages based on specific criteria.
Example: When an Opportunity stage is changed to “Closed Won”, update a custom field on the related Account called “Last Opportunity Close Date”.
b) Process Builder:
- Definition: More advanced automation tool that can handle multiple criteria and actions.
Example: When a new high-value Account (Annual Revenue > $1M) is created:
- Create a task for the assigned Account Manager to schedule a welcome call.
- Send an email alert to the regional sales manager.
- Update a field on the Account to mark it as “Strategic Account”.
c) Flow Builder:
- Definition: The most powerful declarative automation tool in Salesforce, capable of complex logic and data operations.
Examples:
- Screen Flow: Guide a user through a complex data entry process, like creating a new product bundle.
- Autolaunched Flow: Automatically calculate and update commission amounts when an Opportunity is closed.
- Scheduled Flow: Run a weekly process to identify inactive accounts and assign follow-up tasks.
Problem-solving approach for Automation:
- Clearly define the business process you want to automate.
- Identify the trigger for the automation (record creation, field update, etc.).
- Determine the complexity of the automation:
- Simple, single-object automation? Consider Workflow Rules.
- Multi-object or multi-step process? Look at Process Builder.
- Complex logic or user interaction needed? Flow Builder is likely the best choice.
- Always consider the order of execution and potential conflicts with existing automations.
Salesforce Data Management
- Data Import:
a) Data Import Wizard:
- Built-in Salesforce tool for importing up to 50,000 records
- Best for: Small to medium data imports, especially for standard objects
- Example: Importing 10,000 new leads from a recent marketing campaign
b) Data Loader:
- Desktop application for importing up to 5 million records
- Best for: Larger data volumes, custom objects, or complex mappings
- Example: Importing 200,000 product records with custom fields
c) API-based Import:
- Using Salesforce APIs (like Bulk API) for programmatic data import
- Best for: Very large data volumes, real-time integrations
- Example: Syncing 1 million customer records from an external ERP system daily
- Data Export:
a) Data Export Service:
- Built-in Salesforce feature for weekly or monthly org backups
- Example: Setting up weekly automated backups of all Salesforce data
b) Report Export:
- Exporting data from Salesforce reports
- Example: Exporting a quarterly sales report to Excel for further analysis
c) API-based Export:
- Using Salesforce APIs for programmatic data export
- Example: Daily export of updated customer data to sync with a data warehouse
- Data Quality:
a) Validation Rules:
- Formulas that verify data meets specific criteria before saving
- Example: Ensuring all Opportunities over $100,000 have a completed “Risk Assessment” field
b) Duplicate Management:
- Tools to prevent and manage duplicate records
- Example: Setting up duplicate rules to prevent creation of duplicate Accounts based on name and billing address
c) Data Cleansing:
- Processes to clean and standardize existing data
- Example: Using a Flow to standardize phone number formats across all Contact records
- Data Retention:
a) Field History Tracking:
- Tracking changes to field values over time
- Example: Tracking changes to the “Stage” field on Opportunities for audit purposes
b) Big Objects:
- Custom objects designed to store and manage massive volumes of data
- Example: Creating a Big Object to store detailed customer interaction logs over several years
c) Data Skew:
- Managing scenarios where a small number of records have a very large number of child records
- Example: Optimizing a trigger on Contacts to handle accounts with over 100,000 associated contacts
When thinking about Data Management in Salesforce, consider these key points:
- Volume: How much data are you dealing with? This often dictates the tools and approaches you’ll use.
- Frequency: How often does data need to be imported or exported? This impacts whether you use manual processes or automated ones.
- Complexity: Are you dealing with standard objects or custom ones? How complex are your data relationships?
- Quality: What measures are in place to ensure data accuracy and prevent duplicates?
- Performance: How will your data management processes impact system performance?
Here’s a practical example that ties these concepts together:
Scenario: Your company acquires another business and needs to merge their customer data into your Salesforce org.
Approach:
- Data Import:
- Use Data Loader to import 500,000 customer records from the acquired company.
- Set up a nightly API-based import to sync ongoing changes from their legacy system.
- Data Quality:
- Create validation rules to ensure critical fields (e.g., email, phone) are in the correct format.
- Set up duplicate rules to prevent creating duplicate Account records during the import.
- Use a Flow to standardize company names and addresses post-import.
- Data Retention:
- Enable field history tracking on key Account fields to monitor changes during the merge process.
- Create a Big Object to store detailed historical data from the acquired company’s system.
- Data Export:
- Set up weekly data exports to create backups during the merge process.
- Create a daily API-based export of updated customer data to the company’s data warehouse.
This approach addresses the volume of data (using Data Loader and APIs), ensures data quality (validation rules, duplicate management), considers retention (field history, Big Object), and includes necessary exports for backup and integration purposes.