Data Modeling
Posted 乄清雅轩灬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Data Modeling相关的知识,希望对你有一定的参考价值。
Data Model
Salesforce的数据模型类似于数据库对数据的组织形式
In Salesforce, we think about database tables as objects, we think about columns as fields, and rows as records.
Objects
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.
Fields
Every standard and custom object has fields attached to it. Let’s get familiar with the different types of fields.
Field Type | What is it? | Can I get an example? |
---|---|---|
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. |
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.
Object Relationships
objects relationships是关联两个object的一种手段,Salesforce自带一些标准的关系,如Contact就是一种标准的关系;此外,还可以定制自己的relationship;定制关系有三种类型:
Lookup Relationships、Master-Detail Relationships、Hierarchical relationships
Lookup Relationships
In our Account to Contact example above, the relationship between the two objects is a lookup relationship. A lookup relationship essentially links two objects together so that you can “look up” one object from the related items on another object.
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. For our DreamHouse scenario, you could create a one-to-one relationship between the Property object and a Home Seller object.
Master-Detail Relationships
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.
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.
Hierarchical relationships
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
schema builder可以通过可视化的类图查看数据模型,查看定制的objects以及各objects之间的relationships;
schema builder还可以建立新的objects,为已存在的objects添加新的fields;具体操作在Elements操作栏中;
以上是关于Data Modeling的主要内容,如果未能解决你的问题,请参考以下文章