- One-to-many(lookup/ master-detail)
- Many-to-many------创建junction object 然后用2个master-detail建立联系
Master-detail | Lookup |
Customer-customer/ standard-customer Standard obj必须是master | 任意两个object |
一删全删 | 可以配置---清空child表中的parent字段/防止删除parent记录 |
Master 必须有 | Parent 可以为空 |
Detail表没有owner,由master 表确定owner,因此detail不能有queue, queue需要owner | Parent 和child 不相关 |
Security 由master表确定 | 不继承parent 表的security设定 |
可以使用rollup summary | 不能使用rollup summary |
可以使用cross-object workflow | 不能使用cross-object workflow |
一个object最多有2个master | 一个object最多有25个lookup(formula 字段只可以用10层) |
Detail表不能是其他表的master Master不能再做其他表的detail, 例如:1(M)---2(D) -----3 1表上不能再建MD 3表上可以建MD连到2
| 可以多层嵌套 |
如果没有roll-up summary可以re-parent | 可以创建Self Relationship |
可以转为look-up | 有限制 |
可以实现related list(parent上显示child) | 可以实现related list(parent上显示child) |
Master-detail:
Child最好不要超出1万
Child最多往下3层,即算第一个master,一共4个,参考MCCP
Detail and subdetail records inherit security settings and permissions from the master record. You can’t set permissions on the detail record independently.
The master-detail relationship field (which is the field linking the objects) is required on the page layout of the detail and subdetail records.
实现one-to-one:
- Lookup方法
- Object B lookup A,
- B 上建立一个unique field存放A的id
- 使用workflow更新B上的unique field
- Master-detail
- A-B master-detail relationship, B is detail side.
- A上创建roll-up summary field统计B的数量
- 使用validation rule 检测roll-up summary 是否大于1