Platform App Builder Intro

Data Modeling and Management Introduction

Let’s Talk About Objects

  • Salesforce is special because it is an object-oriented system that can be customized using declarative means.
  • Each instance of Salesforce includes certain Standard Objects: Accounts, Contacts, Opportunities, Cases, etc.
  • Custom Objects: defined by the user. Good candidates are anything created in a form or a spreadsheet.
    • Biannual survey of clients - might be related to a Contact or Account.
    • “Feedback” or “Coaching” records generated by managers about their employees' areas for improvement - might be related to a User.

Understanding Standard Objects

  • “API Name” - used behind the scenes. Do not include spaces.
    • Will include “__c” for custom fields.
  • Can enable “Person Accounts” in orgs - but once done this cannot be turned off.
    • Make make sense in some B2C applications.
    • At time of MW’s recording (2016), Person Accounts were only available in Classic.
      • 2017 was roughly when the transition from Classic -> Lightning began getting traction.

Understanding Custom Objects

  • MW’s course involves creating an IMDb clone (Internet Movie Database)
  • When creating new custom objects, its best to turn on all optional features. Some of them can only be enabled during initial object creation.
    • “Allow Reports,” “Allow Activities,” “Track Field History,” “Allow in Chatter Groups”
  • During creation, can turn Deployment Status to “In Development” instead of “Deployed,” which prevents all users except Admins (or those with the “Customize Application” permission)
  • Best to turn on “Notes and Attachments” at this point as well. And, setting up Tabs at this point is more efficient than creating later.
  • Can select to add this tab to custom apps and “Append tab to users' existing personal customizations.”
  • Created Production object

Helpful Practice Activity – Creating Custom Objects for an IMDb Clone App

  • Created Person and Production Position objects.
    • Production Position is a Junction Object providing a many-to-many relationship between Person and Production.

Understanding Standard Fields

  • Custom objects will not have custom fields (with “__c”) built automatically
  • Name, Owner, Created By, Last Modified By are fields that are universal across all objects
  • Standard fields cannot be removed but you can change their attributes

Understanding Custom Fields

  • Custom number fields can have 18 total digits (left of decimal + right of decimal).
  • Added custom Year field: Year__c, Number(4, 0)

Understanding Field Types

  • Red asterisks indicate a field is required during record creation.
  • Salesforce puts commas into number fields, which look odd for years.

Creating Text and URL Fields

  • Text Areas give more vertical space than Text fields
  • If a URL is typed into a text field, the browser will make that field a clickable link within Salesforce. Best practice is to make fields that will contain just a URL field to be URL data types
  • Text Area (Rich) lets users add formatted text

Setting Field Level Security on a Field

  • Allows you to specify visibility and read-only-ness for each profile.
    • “Required” fields will have the FLS checkboxes disabled.

Viewing Field Accessibility on a Field

  • View Field Accessibility button shows whether each field is Read-Only, Hidden, Editable by each Profile
    • Clicking into that level on the field lets you change FLS, page layout assignment, and make changes to the page layouts

Setting Field History Tracking for Changes to Field Values

  • Accessible via Fields & Relationships section on an object
    • For some fields, can Track old and new values for others can Track changes only
  • Very helpful for troubleshooting
  • Max 20 fields can have history tracked
    • Can also track history on Chatter fields, so a possible hack is to leverage Chatter to track history on additional fields

Creating an Auto-Number Field

  • Example Auto-Number field for Production Position: ProdPos-{00000}, starting with 1, so ProdPos-{00001}

Identifying Salesforce IDs via URLs and the Salesforce Workbench

  • Two types of IDs in Salesforce: 15 character and 18 character
    • Example 18-character: 0014x0000098v3oAAA - available in the URL
      • Account records all begin with 001
      • Case records all begin with 500
      • Custom objects, like Production, begin with an a which then increments upward: a00, a01, etc.
  • is a tool that developers use, and a good buzzword for a resume.
    • Includes ability to write SOQL (“sock-quell”) queries and retrieve records directly in the browser
    • Writing a query on an object using SOQL is a quick way to get a list of their 18-digit IDs

Creating a Basic Formula Field

  • Salesforce IDs are not the same as Case Numbers, for example
    • Possible to add Salesforce ID to page layout using a formula: Id
    • In Formula fields, it is possible to “Treat blank fields as zeroes” or “Treat blank fields as blanks”

Creating a Checkbox Field

  • Field “Description” are for behind-the-scenes work (admins, developers).
  • Field “Help Text” is for end users.

Creating a Currency Field

Enabling Multi-Currency in Your Org

  • At time of MW’s recording, activating multiple currencies required human action by SF for the process to be completed. Now, this can be completed through org setup by admins.
    • Org IDs need to be provided to Salesforce Support, for example: 00D4x00000507nA. It is available under the company information page on Salesforce.
  • Will open up a Manage Currencies option in Salesforce
  • Can change the “Corporate Currency” from something other than USD.

Keep Your Currency Exchange Rates Up to Date

  • Change the currency on a user record will add the converted currency as a paranthetical: Expected Revenue USD 235,000.00 (GBP 173,900.00)
    • Advanced Currency Management is a separate setting in addition to multi-currency that allows orgs to manage dated exchange rates.
      • There are apps on AppExchange that update Salesforce orgs' exchange rates automatically, for example: S4G’s Automated Currency Updater
      • MW prefers installing apps for All Users and then removing access from users

Creating Date Fields

  • Date, Date/Time, and Time are all different field types
    • Date/Time includes separate Date/Time fields

Creating an Email Field

  • Salesforce validates that the email contains an “@” and a domain (".something")

Creating a Geolocation Field

  • Includes separate Latitude/Longitude fields in Degrees, Minutes, Seconds or Decimal: “35.9 , 86.7”, for example
  • Can pull up Lat/Long locations in Google Maps, for example

Working with Salesforce Mobile & Lighting Actions in the Page Layout

  • “Quick Actions” are different from “Mobile and Lightning Actions”
    • “Mobile and Lightning Actions” can be set up to inherit from “Quick Actions”
  • Some actions in Lightning Experience do not show up as buttons because they are available under the Activity or Chatter sections of the page layout, even if they are included in the “Mobile and Lightning Actions” part of the page layout

Creating a Custom Object and Number Fields Using the Schema Builder

  • Objects can be created directly from the Schema Builder
    • Creating objects through the Schema Builder will not create the object’s tab
      • Can create after the fact via Settings > Quick Find > “Tab”

Creating a Percent Field

  • Enter “10” and the field will hold the value “10%” - do not need to enter “0.1,” and will automatically the “%”

Creating a Phone Field

Creating a Picklist Field

  • Changing a picklist value will also update the picklist values of all existing records from the old to the new value.
  • Production Position is a junction object. Junction objects provide a many-to-many relationship between two other objects (ex: Production, Person).
    • Ex: “John Doe” was an “Actor” in the movie “John Doe is a Deer Detective”

Creating a Multi-Select Picklist Field

  • Ex: Social Network field contains “Facebook;Snapchat;Instagram
    • To dataload into a multi-select picklist, separate the values with semicolons as shown above

Creating a Dependent Picklist

  • Need to specify a Controlling and a Dependent field
    • Ex: if Type is Social Network, the Social Network field becomes live

Creating a Lookup Relationship

  • Two options for when the lookup record is deleted:
    • Clear the value of this field. You can’t choose this option if you make this field required
    • Don’t allow deletion of the lookup record that’s part of a lookup relationship
  • Adding Lookup Filters is a powerful way to limit the records that are available in the lookup field
    • Ex: Contact: Account ID equals Case: Account ID
  • When you add a Lookup field, a Related List is created by default
    • For example: adding a Secondary Contact (Contact) Lookup to Cases will create a related list on Contact by default called “Cases.” It makes sense to relabel this related list as “Secondary Contact Cases.”

Creating an External Lookup Relationship

  • External Lookup Relationships: “Creates a relationship that links this object to an external object whose data is stored outside the Salesforce org.”
    • Org will need an “external object” to connect to. External objects are external data sources that the org can connect to.

Creating a Master-Detail Relationship

  • During creation of a Master-Detail relationship, need to specify the minimum access level required on the Master record to create, edit, delete related Detail records:
    • Read Only: Allows users with at least Read access to the Master record to create, edit, or delete related Detail records.
    • Read/Write: Allows users with at least Read/Write access to the Master record to create, edit, or delete related Detail records.
  • MW prefers selecting the setting to enable “Reparentable Master Detail”
  • When creating a new master-detail relationship, there cannot be instances of the detail object already in the org unless they have a lookup relationship to the master. In that situation, the lookup relationship can be converted to a master-detail.

Creating an Encrypted Field

  • Social Security numbers are a good use case for an encrypted field
  • Various “mask types” and “mask characters” available:
    • Mask Type ex: Last Four Characters Clear, Social Security Number:
    • Mask Character ex: X or *
    • ***-**-1234

Roll Up Summary Fields

  • Roll-Up Summary Help article
    • The detail record must be related to the master through a master-detail relationship.
    • For example, you want to display the sum of invoice amounts for all related invoice custom object records in an account’s Invoices related list. You can display this total in a custom account field called Total Invoice Amount.
  • Can provide a Sum, Min, Max, or a Record Count

Sample Exam Question #4 from Exam Guide

  • A roll-up summary field on a custom object is needed to count the number of related records on another custom object. What type of field must exist before the roll-up summary can be created, and where should it be located?
    • A master-detail relationship field on the child object. Master-detail relationships are established from child to parent, not vice versa. Bottom-up, not top-down.
    • Ex: field on Accounts that totals up Total Open Opportunities
    • Ex: field on Production that totals up the number of Episodes in a TV show. Presumes the existence of a master-detail relationship from Episode back to Production.

Considerations When Changing a Field’s Type

  • Help Topic on Changing Custom Field Types
  • Changing from a multi-select picklist to a regular picklist will remove all existing data in that field - significant data loss could result
    • Best to test out these sorts of changes in a Sandbox environment and then push the changes to production in a change set

Introducing and Installing the Data Loader

  • Install data loader from Setup > Data Loader
  • Currently can only install data loader on Windows and Mac, not Linux

Logging in to the Data Loader with a Security Token

  • At time of MW recording, it was sometimes necessary for users to append their security token to their password in the password field to log in to data loader.

Importing Data - Which Tool is Best?

  • Data Import Wizard only supports:
    • A few Standard Objects: Accounts/Contacts, Leads, Solutions, Campaign Members
    • Custom objects
  • If more than 50K records need to be imported or other standard objects need to have data imported, then should use data loader
  • Per MW, Admins are typically more familiar with the Data Import Wizard, Developers are typically more familiar with Data Loader

Data Loader Configuration

  • From within the data loader, access settings by Settings > Settings
    • Can increase the Batch Size from default of 200 up to 2000
  • “Insert Null Values” - checkbox to overwrite fields with null values, if the fields in the CSV file are blank
    • Best practice is to leave as unchecked unless you intend to remove data
  • To access Sandbox accounts using Data Loader, use Server Host =
  • Upsert: inserts or updates new records, relying heavily on the Salesforce ID

Mass Transfer of Records

  • Mass Transfer Records was available on the leads list view page in Classic under Tools, but is not in Lightning
  • In Lightning, access “Mass Delete,” “Mass Transfer,” “Mass Update” from Setup > Quick Find > “Mass”
  • Mass Transfer is a way to transfer records from one owner to another based on criteria (“Lead Status” equals “Open - Not Contacted,” for example)
    • Identical functionality available using Data Loader, but less convenient due to needing to work with User IDs and not User Names
    • 005 - starting digits for User IDs
    • 003 - Contacts
    • 001 - Accounts

Helpful Practice Activity – Creating Unique ID / External ID

  • Example application for Unique IDs, External IDs might be an integration between Contacts in Salesforce and a different piece of accounting software for paychecks and payroll
    • Two parameters are set up during text field creation:
      • Unique prevents duplicate values (case sensitive/insensitive)
      • External ID sets this field as the unique record identifier
      • Field might be designated as: “Text(10) (External ID) (Unique Case Sensitive)”
  • A common task in orgs is setting up an automation where every time a new User is created, a corresponding Contact is also created
    • Can be done with a Trigger
    • Can similarly create a trigger where if a User is deactivated, the corresponding Contact is also deactivated

Exporting Data from Salesforce

  • Few options available for data export:
    • Data Loader
      • “Export All” includes recently deleted objects, “Export” does not
      • “IsDeleted” is the flag that indicates a record has been deleted, can add the condition “WHERE IsDeleted = true” to just pull recently deleted objects
    • Reports
      • Export reports (usually okay to keep encoding as ISO-8859-1)
    • Data Export
      • Access via: Setup > Data > Data Export
      • Monthly in developer orgs, Weekly on Enterprise orgs and above
      • Includes CSV files containing all records across all objects
    • Workbench (

Relationship Types and Implications on Record Access

  • In Master-Detail relationships within the Schema Builder, the “child” is the object that has the crows foot touching it.
    • Episodes is Detail in the Production-Episode relationship, for example.
  • Relationship considerations help article
  • Each custom object can have up to 2 master-detail relationships and many lookup relationships
  • When you define a master-detail relationship, the custom object on which you are working is the “detail” side of the relationship

Relationship Types and Implications on User Interface

  • Relationships Among Objects from the Developer Guide
  • When a record on the master object is deleted, its related detail records are also deleted

Relationship Types and Implications on Reporting

  • Reference bottom section of this help article
  • The type of relationship you create affects which standard report types are available and how they are categorized.
    • Lookups allow data from the two related objects to be joined in one report
    • Master-detail relationships data from three objects to be joined in one report: master, detail, plus one other lookup
    • Many-to-many relationships provide two standard report types that join the master objects and the junction object

Mass Delete Records

  • Different ways to mass delete records:
    • Setup > Mass Delete Records
    • Run a report that includes the Id for an object, export that report, and then delete using data loader
  • May be necessary to mass delete records if the org is running out of “Used Data Space” which is the data used up by the records in the org
    • Used File Space includes these like attachments
    • Available from Setup > Company Information

Introducing External Objects and External Data Sources

  • From text on Setup > Data > External Objects page: “Use external objects to virtually represent external data as Salesforce objects. External objects map to a table in a data source outside the Salesforce org and enable access to that data via custom tabs and search. Each external object requires an external data source definition for connection details.

Creating External Objects & Data Source with Salesforce Connect and Heroku

  • Salesforce1 Lightning Tutorial
    • Installs the “Lightning Connect Quickstart” app and connects to a read-only public database with no login credentials required
    • Creates the external object via: Setup > External Objects
  • External object API names have the suffix __x rather than __c
  • External objectrs have a reference to their external data source and a table within that source
  • External objects have different standard fields including Display URL (OData 2.0 URL representing a record in the external database) and External ID (primary key for each record)
  • External data is never duplicated in Salesforce. Lightning Connect always fetches current external data in real-time.

Introducing the Schema Builder

  • Schema Builder can be toggled to “Display Element Labels” (Production) or “Display Element Names” (Production__c)

Practice Activity – Creating Custom & Junction Objects in the Schema Builder

  • Junction objects have master-detail relationships with two other objects and as a result is situated “between” them.