Account & Opportunity 关于SFDC标准对象的理解

今天在学习TrailHead的时候发现一个很有趣的问题,Account和Opportunity之间到底是什么关系,其实如果你从ObjectManager里面的Field&Relationship里面可以看到他们之间是Lookup关系,但是我们也知道Roll-up Summary字段的创建是建立在Master-Detail Relationship上的,但在Account对象里面我们是可以创建对Opportunity的Roll-up Summary字段的。后面查找资料得到这样的一段解释:

Even though the relationship is a lookup, Salesforce treats certain standard object relationships in a hybrid model

i.e. Relationship is Lookup but behaves like Master Detail

Also in the backend there is a relationship property "cascadeDelete" between Contact and Account which is always set to True.You will find the same cascadeDelete Property between objects in a Master Detail Relationship.

So for any relationship where the cascadeDelete is set to True a child record is deleted when the parent is deleted.

大概意思是说:即使他们在SFDC里面是Lookup的关系,但是实际上在SFDC的标准对象在一个等级关系里面,我们可以拿他们当做Master-Detail Relationship来对待。

Interesting!!!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容