Questions tagged [master-detail]
This type of relationship closely links objects together such that the master record controls certain behaviors of the detail and subdetail record.
412
questions
18
votes
2
answers
4k
views
Delete triggers don't cascade master to detail, so why not hand-cascade on the master?
I understand from experience that Master-Detail deletion triggers do not cascade. For example if I delete my Account the Contact deletion triggers don't fire.
Having devoured the first and second ...
15
votes
2
answers
16k
views
Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field
I am trying to deploy an update to a custom object. The object and classes associated with it work perfectly in my sandbox, but when I try to deploy, I get the following error:
Cannot set ...
13
votes
1
answer
12k
views
Why can't I create a master-detail relationship between Product and my custom object?
Trying to create a master-detail relationship between my custom object (detail) and the standard product object (master). Initially it said I couldn't create this because I needed to make sure all ...
13
votes
3
answers
9k
views
Can you convert a Master-Detail relationship to a Lookup if it's referenced in code?
I've got a Master-Detail relationship on a custom object where the parent is the Account object. There are no roll-up summary fields on the Account object, and there are no formula fields on the ...
11
votes
1
answer
1k
views
Obtaining Single Record - SOQL vs. Instantiating New Object
Background
I have a custom object which has a master/detail relationship to Opportunities. Whenever a record on this custom object is created or edited, I need to update the parent opportunity (and ...
9
votes
2
answers
29k
views
Is it possible to convert a Master-Detail relationship to a Lookup?
I'm going through the Trailhead training (here), and see the following two snippets which seem to disagree:
"It’s possible to change a lookup relationship to a master-detail
relationship, but not ...
9
votes
1
answer
18k
views
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] on opportunity
I have created an object named as "Component" which has Master-Detail Relationship with Opportunity Object.
On Opportunity we have a button says "Create Component", when user clicks on it it takes ...
8
votes
3
answers
7k
views
Master-Detail Relationship Limit
Salesforce says "As a best practice, don't exceed 10,000 child records for a master-detail relationship." here : http://na1.salesforce.com/help/doc/en/relationships_considerations.htm
What does "for ...
8
votes
2
answers
9k
views
Cannot set sharingModel to ReadWrite on a CustomObject with a MasterDetail relationship field
Has anybody bumped into this error when spinning a new scratch org?
Here's how this happened. I created a new scratch org and created 2 objects. One had a lookup field to the other. Then I pulled ...
7
votes
1
answer
2k
views
Does Lookup Skew affect only master-detail relationships or also lookup ones?
I've been encountering and reading a lot about data skew issues, particularly lookup skew, and I've noticed that most information I've found doesn't explicitly indicate whether this affects master-...
7
votes
1
answer
7k
views
Why can't Leads or Users be Masters in a Master-Detail relationship
I ask this both out of curiosity, and if I wanted to create an object that I wanted to act as a child to one of those objects I would have a better idea how I could do that. Let's say for example ...
7
votes
3
answers
4k
views
Upsert Detail object without external Id
I have two related objects (Master-Detail) A -> B (where B is child of A). In addition there is only one B for a parent A.
I need to upsert the B object and I only have the A.Id and other fields of ...
6
votes
1
answer
8k
views
What are the implications of using a reparentable master-detail relationship instead of a lookup?
Since the Summer 12 release of salesforce it's been possible to set the "Allow reparenting" attribute on master-detail fields. This somewhat blurs the traditionally clear line of when to use a master-...
6
votes
1
answer
3k
views
"Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail" on an "sfdx force:source:push"
Been getting the error:
Cannot set sharingModel to ControlledByParent on a CustomObject
without a MasterDetail
this morning when editing/adding fields to some custom objects that are in a master-...
6
votes
2
answers
3k
views
SOQL Outer Join Multi Level Master Detail Relationship
I am working with a 3 Level Master Detail Object Relationship:
"Level 1" has "Level 2" detail records
"Level 2" has "Level 3" detail records
I am trying to Query "Level 1 records" and using an ...
6
votes
2
answers
2k
views
Master Detail Relationship
I have master-detail relationship between A-B object. A is master and B is child .
Now the requirement is , that A must be public and B must be private. what's the best way to implement this.
6
votes
2
answers
5k
views
profile object permissions for a detail record
When readng through trailhead salesforce I came across a line which I am unable to digest. The line says - "You can’t set profile object permissions for a detail record". What does this mean? In my ...
6
votes
2
answers
4k
views
Custom Related List with Custom Object
I am quite new to Salesforce and have not yet any thing like the following.
We have a Paper object which is looking up for authors in Contact object. We want to create to have custom related list of ...
6
votes
1
answer
1k
views
Do Master Records (in a Master-detail Relationship) Get Locked?
Suppose the following:
There's a master-detail relationship between two custom objects
There are no roll-up summary fields on the master object
There are no declarative automations or Apex triggers ...
6
votes
1
answer
2k
views
Soql query on parents other child object
I want to write a soql query , My scenario is as follows. I have three objects objectA,objectB,objectC. objectA is the parent object for both objectB,objectC.
objectA - objectB (Master-detail ...
6
votes
1
answer
761
views
What happens to Master-Detail after deleting (Managed Package)
When I delete a Master-Detail relationship in my managed Package
Will it be replaced by a Lookup, like this Knowledge arcticle says?
Will there still be a Master-Detail relationship in our customers ...
5
votes
2
answers
1k
views
Convert SQL query into SOQL query
I've been trying to figure out how to turn this SQL query into a SOQL query. Every time I think I am getting better with SOQL something comes along and erases that thought. Account is the parent ...
5
votes
6
answers
37k
views
How many master-detail relationships per object?
All I see online is that each object can have 2 master-detail relationships, but on the Salesforce App Limits PDF : https://na5.salesforce.com/help/pdfs/en/salesforce_app_limits_cheatsheet.pdf
It ...
5
votes
3
answers
6k
views
How do you use an external ID in the import wizard to import child objects of a master/detail relationship?
OK, I need to import a few thousand records and import wizard seemed like a good choice. First I did some accounts - that went smoothly. Next I went to import some custom objects that have a master/...
5
votes
2
answers
5k
views
How to report on a master-detail relationship
I have a custom object named Milestones (with a field named MilestoneType) that has a Master-Detail relationship to Contact. I want to build a report where I can pull all contacts that have a ...
5
votes
1
answer
10k
views
Visibility of records in a junction object - AND based or relationshipOrder based?
I have a question about junction object record visibility. I will start with a snippet from an SFDC document:
https://help.salesforce.com/apex/HTViewHelpDoc?id=relationships_considerations.htm&...
5
votes
1
answer
746
views
When using FOR UPDATE does Salesforce also lock the child records in a master-detail relationship?
For example, say I get a List of rows to delete using FOR UPDATE. These are all parent records in a master-detail relationship. Will the children be locked?
5
votes
1
answer
1k
views
Using Global Actions to Create a child record - MD relationship
Is it possible to use Global Actions in Salesforce to create a Child Record in a Master-Detail Relationship?
I only see the master in the list of Target Objects.
5
votes
1
answer
2k
views
Update custom Lightning Component on Master when Detail "Related List" Component edited
I have a custom Lightning Component on an Opportunity Record FlexiPage, that shows a Master-Detail relationship Rollup Calculation (e.g. the count of detail records). After adding an item via the "...
5
votes
1
answer
2k
views
How to implement Lookups in Lightning Components?
Assume you have a Lookup or Master-Detail relationship defined in the metadata and now you need a simple UI.
In Visualforce lookup-controls on the UI run out-of-the-box using <apex:inputField ... /...
5
votes
1
answer
1k
views
Child Record delete invoking Parent trigger
I have written a trigger on Parent__c Object (after insert,after update-This trigger creates a child__c record depending on few conditions). But when i am deleting child__c record, it invokes this ...
5
votes
1
answer
1k
views
Does adding a detail record cause an update event on the master record?
Background
I have a master-detail relationship between two objects, let's call them:
parent__c
child__c
Once the parent__c record is in a certain status__c we block any changes using a before ...
5
votes
1
answer
2k
views
How to refer to an existing record in REST API composite JSON?
When using REST API composite JSON, how to refer with external id
an existing record
to existing Master-Detail parent from a newly created child
We have the following objects:
Organization__c:
Has ...
5
votes
2
answers
260
views
How to denormalise a Master-Detail relationship
Contacts have Specialities (skills) to sell so I have a Master-Detail from Contact to Speciality. We sell Product (1/2 day, full day) for those Contacts so the Product has a lookup to the Contact. ...
4
votes
2
answers
4k
views
Illegal assignment from sObject to Id
I'm trying to insert two master-detail lists at the same time. I'm looking through Bob Buzzard's blog post: http://bobbuzzard.blogspot.com/2012/03/create-parent-and-child-records-in-one.html Where he ...
4
votes
1
answer
1k
views
Can Detail Objects trigger Master Object Workflows?
I want changes to detail objects to trigger a workflow on the master object.
The master object has a rollup summary field which COUNTs how many detail objects have a certain field set. When I change ...
4
votes
1
answer
12k
views
Relationship between Account and Opportunity and Account and Contact
On Opportunity there is a lookup relationship to Account.But why it behaves as Master-Detail as we can create Rollup Summary Fields on Account.
Similarly if we delete Account then Contact gets ...
4
votes
2
answers
508
views
Reading and writing child relationships of not-yet persisted SObjects?
I have a Parent__c and Child__c custom object connected by a lkp_Parent__c field. I now create an in-memory version (no insert) of a parent-child tree
Parent__c p = new Parent__c();
Child__c c = new ...
4
votes
2
answers
2k
views
100.000 children in Master Detail relationship? What's the downside? [duplicate]
I know that Salesforce is recommending to keep the number of child records in Master-Detail relationships (MDR) below 10.000 records.
In one situation I am heavily relying on Sharing being inherited ...
4
votes
1
answer
2k
views
Any reason not to use Lookups instead of Master-Details for Junction object?
To build n-m relationships one needs a Linker/Junction object with two references. The Salesforce documentation recommends two Master-Detail relationships.
Is there any reason why not to use two ...
4
votes
2
answers
12k
views
A formula number field can't be used in rollup summary
The child object has two formula number field and when I want to create a rollup summary field on parent object, one of them is not available.
What can be the reason of it?
4
votes
3
answers
5k
views
Look Up relation Vs Master detail relation
I have small doubt in choosing between look up field and master detail field.
I have a custom object say cObj1 which should always be related to some other object say cObj2. So I can opt for ...
4
votes
2
answers
7k
views
Can I Update a Child Record when the Parent Changes with Workflows?
I have two objects in a parent-child relationship: job order (parent) and application (child.)
I'm attempting to use workflow rules to update the status of certain applications when the job order is ...
4
votes
1
answer
4k
views
Deleting Custom Objects
I have three connected Custom Object I'm trying to delete. When I attempt to delete them, I get the following message.
'Your attempt to delete .... could not be completed because it is associated ...
4
votes
1
answer
9k
views
Inner SOQL child to parent query
I have written the below parent to child inner query which works :
List<master__c> masterObj = new List<master__c>([Select id, (Select ID FROM detail__r) FROM Master__c]);
Which ...
4
votes
2
answers
7k
views
"maximum depth of master-detail relationship exceeded" Can't change from Look up To Master Detail
I have two Object, Current Relationship is Look Up I am trying change it to M-D. In change Field Type the field itself is "Grayed Out" with this Info.
My Intial requirement was Master-Detail because ...
4
votes
2
answers
476
views
External SalesForce Forms
Is it possible to create external SalesForce Forms that can populate fields in the same way as inside salesforce?
We offer online teaching and the idea is that teachers, after every lesson, can fill ...
4
votes
2
answers
2k
views
Is it possible to query the lookup object fields of child object?How to do it?
We have a parent object say ParentA with its associated child object as ChildA with a custom field customerName of type lookup(Account). Now I would like to retrieve AccountNumber, which is field on ...
4
votes
1
answer
1k
views
How do I deprecate/delete a master object part of a junction object which is part of a managed package?
Here is the scenario: As part of a managed package, we have 3 objects. Object A & Object C are Masters and Object B is the junction object between A & C. We packaged it all up and all good up ...
4
votes
1
answer
9k
views
Querying a Master Detail Relationship
I am currently learning Salesforce and Apex etc and I am stuck trying to write a trigger which contains a query.
Here are my two custom objects:
Student__c (Object)
Nickname__c
Email__c
...