Tuesday, July 4, 2017

Salesforce Administrator Beginner - Data Modelling

A data model is a way to model what database tables look like in a way that makes sense to humans.

In Salesforce, we think about database tables as objects, we think about columns as fields, and rows as records.


When we talk about the data model, we’re talking about the collection of objects and fields in an app. Let’s learn more about objects and fields so you can start building your own data model.


Salesforce supports several different types of objects. There are standard objects, custom objects, external objects, platform events, and BigObjects. In this module, we focus on the two most common types of objects: standard and custom.

Standard objects are objects that are included with Salesforce. Common business objects like Account, Contact, Lead, and Opportunity are all standard objects.
Custom objects are objects that you create to store information that’s specific to your company or industry. 
Objects are containers for your information, but they also give you special functionality. For example, when you create a custom object, the platform automatically builds things like the page layout for the user interface.
Every standard and custom object has fields attached to it. Let’s get familiar with the different types of fields.
Identity
A 15-character, case-sensitive field that’s automatically generated for every record. You can find a record’s ID in its URL.
An account ID looks like 0015000000Gv7qJ.
System
Read-only fields that provide information about a record from the system, like when the record was created or when it was last changed.
CreatedDate, LastModifiedById, and LastModifiedDate.
Name
All records need names so you can distinguish between them. You can use text names or auto-numbered names that automatically increment every time you create a record.
A contact’s name can be Julie Bean. A support case’s name can be CA-1024.
Custom
Fields you create on standard or custom objects are called custom fields.
You can create a custom field on the Contact object to store your contacts’ birthdays.
The “__c” part is an easy way to tell that a particular field is a custom field.Identity, system, and name fields are standard on every object in Salesforce. Each standard object also comes with a set of prebuilt, standard fields. You can customize standard objects by adding custom fields, and you can add custom fields to your custom objects.
Every field has a data type. A data type indicates what kind of information the field stores. Salesforce supports a bunch of different data types, but here are a few you’ll run into.
  • Checkbox—for fields that are a simple “yes” or “no,” a checkbox field is what you want.
  • Date or DateTime—these field types represent dates or date/time combinations, like birthdays or sales milestones.
  • Formula—this special field type holds a value that’s automatically calculated based on a formula that you write. For example, D’Angelo can write a formula field that automatically calculates a real estate agent’s commission on a home sale.
Again, there are quite a few field types, but most of them are fairly self-explanatory. The important takeaway here is that you want to think about what kind of data you’re trying to store when you create a custom field.
Give your objects and fields descriptive, unique names to improve clarity. 
Help out your users. Even with careful naming, your users might not always be clear about the purpose of a particular object or field. Include descriptions for your custom objects and fields. For specialized or complicated customizations, use help text to give more details.
Require fields when necessary. Sometimes, you’ll want to force your users to fill out a field when they’re creating a record on a certain object. Every property needs a price, right? Make important fields required to avoid incomplete data.

Object relationships are a special field type that connects two objects together.

There are two main types of object relationships: lookup and master-detail.
A lookup relationship essentially links two objects together so that you can “look up” one object from the related items on another object. Account to Contact relationship is a lookup relationship.
Lookup relationships can be one-to-one or one-to-many. The Account to Contact relationship is one-to-many because a single account can have many related contacts.
You could create a one-to-one relationship between the Property object and a Home Seller object.
While lookup relationships are fairly casual, master-detail relationships are a bit tighter. In this type of relationship, one object is the master and another is the detail. The master object controls certain behaviors of the detail object, like who can view the detail’s data.
Here’s a bit more information to help you differentiate between lookup and master-detail relationships.
Typically, you use lookup relationships when objects are only related in some cases. Sometimes a contact is associated with a specific account, but sometimes it’s just a contact. Objects in lookup relationships usually work as stand-alone objects and have their own tabs in the user interface.
In a master-detail relationship, the detail object doesn’t work as a stand-alone. It’s highly dependent on the master. In fact, if a record on the master object is deleted, all its related detail records are deleted as well. When you’re creating master-detail relationships, you always create the relationship field on the detail object.
Finally, you could run into a third relationship type called a hierarchical relationship. Hierarchical relationships are a special type of lookup relationship. The main difference between the two is that hierarchical relationships are only available on the User object. You can use them for things like creating management chains between users.
Schema Builder is a tool that lets you visualize and edit your data model. It’s useful for designing and understanding complex data models.
Schema Builder is great for visualization, but you can also use it to customize your data model. For example, you can manage the permissions for your custom fields directly in Schema Builder. Just right-click the field name and click Manage Field Permissions.
You can also create objects using Schema Builder. If you prefer, you can create objects in this visual interface if you’re designing your system and want to be able to revise all your customizations on the spot.

1 comment:

Lightning Inter-Component Communication Patterns

Lightning Inter-Component Communication Patterns If you’re comfortable with how a Lightning Component works and want to build producti...