Pages

Friday, January 11, 2013

Salesforce: Master-Detail relationship (roll-up summary)

One of the most advantage using Master-Detail relationship compare to Lookup relationship is Roll-Up Summary. In Master-Detail relationship, we can create roll-up summary field in master record to summarize / count data from child records. I wrote a blog earlier for Master-Detail relationship. This blog on roll-up summary field and the field type.

More items to notice when create roll-up summary field:
Parent record is locked
If you implement approval process with lock record in master object, user will not able to create new child record if Sharing Setting in Master-Detail option is Read/Write.
Solution: change the sharing setting to Read Only.



Validation rule on parent record
If user not able to edit parent record because of validation rule, and you have roll-up summary in parent record, user will not able to create or edit child record.
Solution: remove roll-up summary fields.

Can I change field type from Master-Detail to Lookup relationship?
Yes, make sure there is no roll-up summary fields in parent record, also in Deleted Fields (erase from Deleted Fields).

Can I change field type from Lookup to Master-Detail relationship?
Yes, all parent record should be not blank.