-
什么是Object Relationships
数据和数据之间的联系。 -
Object Relationships类型
-Lookup Relationships
两个objects 之间使用Lookup Relationships,可以是1对1,也可以是1对n的关系。
Lookup Relationships的两个objects 通常是比较独立的object,在用户页面上是能够独立执行的object,拥有自己的tab页面。
(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.)
-Master-Detail Relationships
Master-Detail Relationships的两个objects有明确的主从关系,Detail object依附于Master object,Detail object通常没有自己的tab页面,是显示在Master object的页面中。如果Master object的一个record也删了,该条record对应的Detail object数据也会被删。
(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.) -
创建Lookup Relationship
在setup->object manager->Fields & Relationships中new选择Lookup Relationship
关联到contact一路next,save
可以看到DATA TYPE是Lookup Relationship(Contact)的Contact__c创建完成
-
创建Master-Detail Relationship
再new ,选择Master-Detail Relationship关联到Property
一路next,save
可以看到DATA TYPE是Master-Detail Relationship(Property)的Property__c创建完成
-
展示
展示一下我们完成的两个Relationship,Contact页面中,增加了一个Favorite 的关系Property页面中,增加了一个Favorite 的关系
点击一下Favorite 页面中的NEW,就可以看到Favorite跟contact 和property的关联
Awesome!
到这里,我们完成了新建Lookup Relationship,Master-Detail Relationship的过程以及展示。
本人是零基础学习Salesforce,所以可能会有学习上的误区,也可能在文章中有不对的地方,欢迎大家指正和讨论。