Force.com's objects, fields and relationships

  1. Objects logically correspond to database tables in a relational database. Fields of an object is similar in concept to column in relational database.
  2. Objects can be standard or custom. Standard are objects are predefined by Salesforce like Accounts, Case, Contact etc. Custom objects are created by developers based upon application requirements.
  3. Custom objects have the following characteristics:-
    • Custom objects store information that is unique and important to your organization.
    • Custom objects are reportable and search-able.
    • Custom objects have configurable access control features.
  4. Force.com provides undelete functionality on objects. Deleted objects go to a recycle bin with an expiry date of 45 days. An administrator may delete objects from recycle bin.
  5. Fields of type Picklist cannot be made required.
  6. Objects have following fields that need to be entered by developers -
    • Label
    • Plural Label
    • Object Name
    • Description
    • Record Name
    • Record Type
  7. The field for record name is displayed by default when the object has to be displayed (for example in search results). The record type can be text or auto-number. Auto-number can take values like A-{0001}, A-{0002} etc.
  8. The Object name is used to access the object programmatically. __c is added as a suffix to the custom object names. The label name is used for display of the object.
  9. The standard fields are added automatically. Examples of standard fields are Created By, Owner etc.
  10. Custom Fields are added to an object by developers. In the custom object definition detail screen there is a section of custom fields. Click New to create new custom fields in this area.
  11. Read through the Salesforce customizations at www.npsphelper.com/admin.
  12. Custom Fields have properties like:
    • Data Type
    • Field Label
    • Field Name
    • Required checkbox
    • Description
    • Default Value
    • Examples of valid field types are:-

    • Field Type Comments
      Text Text can be upto 255 characters
      Text Area Text Area can be either 255 characters or 32K characters
      URL Allow users to enter valid website address.
      Picklist Can be single select or mult-select. The developer needs to provide valid values
      Currency Allow users to enter a dollar or other currency amount and formats the field as a currency amount.
      Checkbox Allow users to select a True (checked) or False (unchecked) value.
      Percent Allow users to enter a percentage number and adds the percent sign to the number.
      Number Allow users to enter any number. Leading zeros are removed.

    • Changing the data type of existing custom fields is possible, but doing so may cause data loss.
    • Fields can be set as unique, required or as external id. A required field is always displayed in the edit page. A field of type external id is a record id from another system. The performance of reports and SOQL is better for fields defined as external ids. Fields of type number, text and email can be set as external id. Each object can have up to three external ids.
    • A field defined as encrypted is not visible to users. Typical usage of encrypted field is for password. Only users with "View Encrypted Data" can view the encrypted fields. Encrypted fields are editable.
      • This is a provisioned feature, so you must contact Salesforce to enable it.
      • Encrypted custom field cannot be unique, an external ID, or have default values.
    • Objects can have upto 500 custom fields.
    • When an object is created, a user interface is created automatically for Create, Update, Read and Delete operations.
    • Fields of two Picklists can be made dependent on each other. As an example consider an application with customers in US and Canada. If there are two picklists - one for country and the other for state. Based upon user's selections of country, the state settings need to get updated. This is implemented by defining controlling and dependent picklists. In the above scenario, country becomes the controlling picklist and state becomes dependent picklist. The controlling and dependent picklists are defined using "Field Dependency" button in "Custom Field and Relationship" section.
    • Standard picklist can be controlling picklist but not dependent picklist. Maximum number of values allowed in controlling field is 300. A custom multi-select picklist cannot be controlling field in a picklist.
    • Merge fields are fields that display values based upon formula calculations.
    • Salesforce supports history tracking on change in values of fields. This can be enabled for up to 20 fields in an object.
    • Custom objects can be represented using a Metadata XML.
    • Deleted data and metadata is stored in recycle bin.
    • Database tuning is managed by Salesforce. How Objects and fields are stored in the database is internal to Salesforce.
    • The field types are aligned to user interface elements like picklist and checkbox.

    • Object Relationships

    • Force.com allows you to create relationship between objects. The "Custom Fields & Relationship" section of objects is used to define relationship between objects.
    • There are a two types of object relationships that Salesforce supports -
      • Lookup relationship
      • Master-detail relationship
      • These relationships are used to implement one-to-many relationship. They are created as fields in the child record. As an example in a recruitment application if one applicant can have many interviewFeedbacks, we could create a lookup (or master detail) relationship in the interviewFeedback object pointing to the applicant object.
    • In Master Detail relationship, if the parent record is deleted, then all its children records are deleted.
    • Child records in master-detail relationship do not have owners. They inherit ownership from the parent record.
    • In Master detail relationship, the parent field is required. Also the parent field once specified cannot be changed.
    • Standard Object cannot be on detail side of Master-Detail relationship.
    • In the related list section of parent objects, only one field of the child object is displayed by default. This is the field specified as Record Name in the child object. To add more fields, search lookup layout needs to be updated.
    • Rollup-summary fields are supported in master detail relationship. The parent object can use roll-up summary field type to perform operations of sum, maximum, minimum, count among its children records. These fields are read only fields and are used to calculate values from a set of records.
    • Many-to-Many relationships are implemented using two master-detail objects. One Junction object is used as the child of the objects between which many-to-many relationship needs to be established.

    • The table below compares Master Detail and Lookup relationship
    • Lookup relationship Master Detail relationship
      Is Parent a required field NO YES
      Maximum number of relationship in an object 25 2
      Security of parent determines child record's access No YES
      Deleting parent record deletes children No YES
      Parent can be a child in another relationship YES NO
      Roll-up summary in parent supported No YES
    • Self relationship is a lookup relationship to itself. An example usage could be organization chart where an employee's manager is also an employee.
    • Hierarchy Relationship exists only for User object. In this, developers create a manager field in User object to relate to another object.

Page Layout:-Page layouts control the layout and helps to determine which fields are visible, read only, and required. Use page layouts to customize the content of record pages for your users.
For Detailed Information click here

Record Types:-Record types helps you to offer different business processes to different users. It helps you to create different record types which differentiate your regular sales deal and you may offer different picklist values for each.It lets you display different page layouts for your customer according to there need and requirnments.
For Detailed Information click here