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来对待。