[youtube id=fUD4MzgA0gk]
Note: Roll-up summary fields per object has been increased to 25 (previously 10) as of the Winter 16 release.
[box type=”note” style=”rounded” border=”full”]Many standard object relationships exhibit behaviors of both a master-detail and lookup relationship.[/box]
For instance, opportunity to account is a lookup field.
However, you can establish roll-up summary fields on account to summarize opportunity data. And when an account is deleted, all related opportunities are deleted as well.
You don’t need to know the nuts and bolts of every standard relationship, but it is important to know that not all standard relationships are equal.
Hi John,
I have a question about the following statement, particularly the segment after ‘however’:
Source: https://help.salesforce.com/articleView?id=overview_of_custom_object_relationships.htm&language=en_US&type=0
Deleting a detail record moves it to the Recycle Bin and leaves the master record intact; deleting a master record also deletes related detail and subdetail records. Undeleting a detail record restores it, and undeleting a master record also undeletes related detail and subdetail records. However, if you delete a detail record and later, separately, delete its master record, you cannot undelete the detail record, as it no longer has a master record to relate to.
Does this mean that master-detail relationships are deleted when a parent record is deleted and the relationship cannot be restored even after record restoration? If yes, is it also the case with lookup relationship?
Thanks.
OK this is a fun one.
This means that the relationship between a DELETED detail record is broken when the master record is deleted.
E.g.
Account (Master)
Location (Detail)
Create account 1
create location 1 –> account 1
Delete account 1, delets. location 1. restore account 1, restores location 1.
Delete location 1, restore location 1. no problem.
Delete location 1, THEN delete account 1. Restore account 1 will not restore location 1 as this linkage is severed.
That’s how I read it… might be fun to test out
Hi John, thanks for the detailed explanation! May test out later to see 🙂 Thanks!
is below statement correct?
“When you delete a child record on a roll-up Summary field, Salesforce doesn’t recalculate the value of the field. Select the Force a mass recalculation on this field option on the edit page of the roll-up summary field to manually recalculate the value.”
I created roll up summary field in Bugs object for number of cases linked to it. When I deleted the case, the roll up summary on bug was automatically recalculated. Hence above stament doesn’t seem right. It’s mentioned @ https://help.salesforce.com/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&language=en_US
Not true or is misleading. Roll ups reflect record deletions in my experience.
Below statement is bit confusing(https://help.salesforce.com/HTViewHelpDoc?id=overview_of_custom_object_relationships.htm&language=en_US).
” To prevent records from being accidentally deleted, cascade-delete is disabled by default. Contact Salesforce to get the cascade-delete option enabled for your organization.
Then what is meaning of “Delete This Record Also” option in look up relationship?
Regds
Nikhil
Yes I believe so!
Hi John
I saw the below ADM sample question. As per site the answers is “Crossobject formula
field”. I thought it is “Look-up Field”. Any idea ?
Universal Containers uses a custom field on the
account object to capture the account credit
status. The sales team wants to display the
account credit status on opportunities Which
feature should a system administrator use to
meet the reqquirements?
o Look-up Field
o Roll-up summary field
o Workflow field update
o Cross-object formula field
I think i would have also gone for look up field had I not tried it myself. The limitation of look up field seems to be it copies name field from parent (so copies account name on opportunity when you create look up field in opportunity). It sounds a serious limitation that you can not map fields of source and target(otherwise we could have mappend Credit Rating on Account with Credit Rating on opportunity).
To me Cross Object Formula seems to be correct answer in that case but me being newbie could be wrong.
Regds
Nikhil
answer seems correct to me. John request you to please confirm the limitation of lookup field in this case. Thanks!!
Yeah – cross object formula required. Always test in your org when in doubt
Hi John
1. I created a custom object called Applicant and added some records.
2. Created a Lookup relationship to Cases.
3. Updated the Applicant records to update the Cases.
4. Then went back and updated the relationship type with Cases to Master Detail.
Why is it not allowing me to associate more than one case for a new applicant ?
Any idea what else needs to be enabled or If i’m doing something wrong ?
Thanks
To clarify, I was trying to create Many to Many relationship using a standard object for an existing custom object with records
Sounds like you’re trying to create a many to many relationship – you’d need to add another object between applicant and case
A very good help on how to go about many to many relationship https://help.salesforce.com/HTViewHelpDoc?id=relationships_manytomany.htm
Yep – that is listed in the main area
Just another Tip:
You cannot create a new Master-Detail relationship on an existing custom object if records already exist. You must first create a Lookup relationship, populate the lookup field with data in all records, and then change the relationship type to Master-Detail
Hi John,
I’ve got this adm201 dump from another site:
“True or False: The detail object of a master-detail relationship cannot also be a master object of another relationship.”
I answered False but according to the site, the correct answer is True. I don’t understand. For instance, I have three objects in my dev org – Candidate, Job Application, and Review.
Job Application is a detail object of Candidate, while Review is a detail object of Job Application. Thus, Job Application is detail object of a master-detail relationship (to Candidate), while at the same time a master object to another relationship (Review). Am I correct? Or I’m not getting the question right?
Hence why I suggest not using other sites- you are correct, the site’s answer is incorrect (answer is false).
Years (5 maybe) ago that used to be the case, however.
Thank you for responding, John. I got doubt as multiple places in sf documentation it is mentioned:
Notes on Cross-Object Field Updates
For all custom objects and some standard objects, you can create workflow and approval actions where a change to a detail record updates a field on the related master record. Cross-object field updates work for custom-to-custom master-detail relationships, custom-to-standard master-detail relationships, and a few standard-to-standard master-detail relationships.
Link:
https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_field_update_considerations.htm&language=en_US
Ah standard to standard would have to be a relationship created by SalesForce, not one that you created
Can we have a master detail relation ship between 2 standard objects?
You cannot create a master/detail relationship where the standard object is the detail- in short, no
hi, john,
i want to ask u that can we convert relation ships later after creating them …
as we realize later that the one look up i created …that need roll up summary…so can i convert it to master any how …
or the other way if i created lookup and thought its useless to make master detail at that point , can i convert to look up?
is it possible?
And i also want to know how many master and how many look up relations are possible in an object or field?
I believe you can convert between the two. To convert lookup to m/d you would need to make sure all values were populated. Not sure about m/d to lookup – if possible you would need to ensure there were no rollup fields.
so a year from now(winter 2016), the total of roll-up summary per custom and standard object will be 25?
Winter 16 was already released (Winter releases are dated year-forward)
4:32 The limit is no longer 10 roll up summary fields, its 25.
http://www.adminhero.com/getting-cozy-with-the-winter-16-release/
Updated, thanks
Just a fun fact: this is a great resource for anyone trying to overcome the standard limitations. It has worked well in all my orgs so far! http://andyinthecloud.com/2013/07/07/new-tool-declarative-rollups-for-lookups/
Nice, thanks for sharing
John, I’m not clear on why you needed to create a Cross-Object Formula to add Seats to the Course Offering page. You were able to add “Name of Course” by selecting it from a list. Why can’t you just add Seats in the same way?
John, I added this comment to the wrong video. I’ll copy and paste it to the correct video now. Thanks.
The number of seats would be derived from the classroom (e.g. this room holds 30 people). Therefore when a course is offered in this room, it should allow for 30 people. In order to copy that data from one object to another, you’d need a formula field.
On the classroom you can see customize the related list of course offerings to include any fields you’d like (as this is a function of the related list), however, all the course offering will display is a link to the classroom record.
The same would be true for accounts – you can choose which fields of the related opportunities you want to display. However, on the opportunity record itself, you would need to use a formula to display fields from the account.
Note: The header in the presentation says “Fields.” Shouldn’t this say “Objects?”
Question: Are Related Lists Detail objects of Master Objects? For example Account (master) and Contacts (detail)
Lookup and master/detail relationships are fields that establish relationships between objects. Hope that clarifies
Just as an FYI, you can request SalesForce to increase the number of rollup fields available for a specific object to 25.
Good point – that is a soft limit. To my knowledge there is no good resource that outlines what’s a flexible versus inflexible limit.
I thought the Account and Opportunity relationship was a master-detail, but opportunities are standard objects. is this an exception?
Correct- this is an exception. The standard objects do not follow all of the rules exactly as they would be applied to custom objects.