Data Model

Application Essentials

Building Your Data Model

  • Id is indexed, 15 char case sensitive, 18 char, case insensitive, first 3 chars consist of code that identify type of object
  • Name is indexed, required field, text (need not be unique)/auto number (usually unique), appear as first column by default in list/related views
  • owner can represent group/user, has additional previliges, default owner is creator
  • limit on custom fields depend on Salesforce edition
  • Data types:
    • Numeric – number, currency, percent
    • Calendar – Date, DateTime
    • Limited Option – checkbox, picklist, picklist (multi-select)
    • Formatted Text – Email, Phone, URL
    • Text – Text, Text Area (255), Text Area (Long-32768), Text Area (Rich-32768,images,links, formatted), Encrypted – any amount
    • Calculation – Auto-Number (system generated), Formula, Roll-up summary (created on master object, allows calculations on details)
  • Properties
    • Name – used programmatically
    • Label – used in UI
    • Universally required field – required field for all record types and will always display on the edit page
    • Unique field – cannot contain duplicate values, can be case sensitive/insensitive
    • External Id – record id from another system. Fields of type: Text, Number, Email. Can have upto 3. Will have custom index, increases report & SOQL performance
    • Default Value – can be based on formula
  • Standard picklist fields can be controlling fields, but not dependent fields, max # allowed in controlling field is 300. In addition, if a field represents both a controlling field and dependent field, it cannot contain more than 300 values
  • A custom multi-select picklist cannot be the controlling field for a dependent field
  • Encrypted fields – the value of the encrypted field is visible to users who has ‘View Encrypted Data’ permission. Contact Salesforce to get this access. cannot be unique, an external id or have default value
  • Lookup Relationship
    • links custom or standard, independent ownership, security, each object can have upto max of 25 lookup relationships, made required/optional, for optional,
    • if field is optional, can use one of the following actions when a lookup record is deleted:
      • clear value of this field (default)
      • don’t allow deletion that is part of lookup relationship
      • delete this records also. cascade delete bypasses security & sharing settings, allowing users to delete records they don’t have access to.
  • master-detail relationship
    • tightly coupled
    • parent field is always required
    • automatically deletes the child
    • when parent is deleted, ownership & access to child record determined by parent
    • cannot have sharing rules
    • manual sharing or queues, on detail objects because these rules and queues require the owner field
    • cannot contain a standard object on the detail side of the relationship
    • master-detail can be configured so that child records on the custome objects can be reparented
    • cannot create master-detail relationship to users & lead objects
    • page layout should include a field in the child object for the associated master record
  • Difference between Lookup & Master-Detail Relationship
    • Lookup
      • max 25 objects
      • parent required or optional
      • security & access are independent for objects
      • deleting parent object may delete the child, if the child field is required
      • link objects across multiple layers
      • lookup field on page layout depends on required/optional choice
      • cross-object field updates and roll-up summary fields cannot be done
    • Master-Detail
      • max 2 objects
      • parent field on child required
      • access to parent determines access to children
      • deleting a parent automatically deletes the child
      • deleting a parent automatically deletes the child
      • the # depends on whether the master object is standard or a custom object (linking objects across multiple layers)
      • lookup field on page layouts is required
      • cross-object field updates and roll-up summary fields can be done
  • Special relationships
    • self relationship (lookup) & many to many relationships (master detail relationship)
    • junction object
      • custom object with 2 relationships
      • also referred as intersection object
      • moved to recycle bin when any of the associated master reocrds are deleted, however deleted permenantly and cannot be restored when both associated master records are deleted
  • Lookup Filters
    • to limit the search results for related fields (lookup, master-detail or hierarchical)
    • filters can be required or optional, value must match the criteria, if it is required

Building Your User Interface

  • 3 different ways to customize UI: custom apps, custom tabs, custom layouts
  • file size for custom logo is 20 kb, 300 wide by 55 pixels high, add file to documents tab to have it as a header
  • 3 types of custom tabs
    • custom object tabs – display data from any custom object
    • web tabs – display any external web app in UI tab
    • visualforce tabs – display vf page in UI tab
  • Page Layouts
    • defines organization of fields, custom links, field locations, page section customizaions, field properties.

Introduction to Business Logic

  • Cross object formula
    • can be created from objects that are linked either by a master-detail or a lookup relationship
    • can contain objects that span across multiple levels of relationships
    • limit: 10 unique relationships per object across all formulas and rules
    • exceptions:
      • cannot reference in rollup summary fields
      • cannot reference merge fields for objects related to activites
      • cannot reference record owner merge fields for any object
      • If a standard and custom field have identical names or labels, the merge field displays the custom field value.
      • If two custom fields have identical names or labels, the merge field may display an unexpected value.
      • If you create a field label called Email and a standard field labeled Email already exists, the merge field may be unable to distinguish between the fields. Adding a character to the custom field name makes it unique. For example, Email2.)
  • Roll-up summary fields
    • read-only formula fields that can display sum, min, max or record count
    • can add for all custom master-detail relationships & some standard master-detail relationships including account opportunity, and opportunityproduct

Migrating Configuration Changes

  • Configuration changes are stored as metadata
    • (new sandboxes that are not activated within 30 days & the sandboxes that have been locked for 30 days will be deleted)
  • 3 tools to move metadata: change sets, force.com IDE, force.com migration took (ANT based)
  • like email, you send a changeset to org
  • apex code should meet 75% of covering test cases
  • system detects incompatibilities bet versions
  • ability to work with change sets is controlled by profile permissions
  • change sets cannot be modified once it is created.

Leave a comment