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.

Filter by
Sorted by
Tagged with
5
votes
1answer
1k 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 "...
0
votes
0answers
122 views

How to work around data skew problem?

We have a custom object that is a detail of Account. Every account may end up with tens of thousands of records of this object type. We have the business need to actually have those records under the ...
1
vote
1answer
197 views

Self-reference error during a roll-up summary calculation

Up until this point I was of the belief that roll-up summary operations didn't interfere with custom Apex and were calculated quietly in the backend. However, I am seeing otherwise. Consider the ...
3
votes
1answer
203 views

Changing Master-Detail to Lookup, who becomes Owner?

When we convert a master-detail relationship to a lookup, who will be the owner of the child records?
0
votes
1answer
96 views

Assign reference to master record via constructor vs a property

Given two objects Opportunity and Project where Project is a child of Opportunity (master object), I try to assign Project to Opportunity via a property: Project__c updateProject = new Project__c(); ...
0
votes
1answer
151 views

Unable to obtain exclusive access: Master - Detail

We have a master detail relation from custom Invoice object to Account. There are bunch of roll-up summary fields on account calculated from invoice. Other than roll up no where we have logic in ...
1
vote
1answer
55 views

Is it possible to have a validation rule with a finely nuanced loophole to create and modify detail records?

We have Opportunity with a custom checkbox property "Locked__c". While this value is set to true (never mind how), it should be impossible to change any value on the Opportunity. The Opportunity has ...
1
vote
1answer
69 views

How to do aggregate functions in master detail relationship

I have 2 objects student and course ..I want to calculate total number of students for particular course I have to find. Count of students in each course Student’s maximum fee in course Minimum fee ...
2
votes
1answer
920 views

Roll-up summary implications and behind the scenes calculations

We have a master-detail relationship with Account and a custom object. We have created a roll-up summary to count the number of custom object records for the account to help us with scaling some ...
0
votes
1answer
390 views

Formula field in Opportunity to populate Opportunity Line Items

I have given a requirement of populating the Opportunity Line Items in a formula field in Opportunity Object. But i find it unable to write the formula for this as Opportunity Line Items And ...
0
votes
0answers
411 views

Deleting junction objects

I have a use case where the Master object can only have one child object at a time, so when a user selects a new child object I need to delete the original junction object via Apex and create a new ...
0
votes
0answers
238 views

id value of incorrect type error in lightning but works fine in classic

I have a master detail relationship between 2 objects. When creating the child object in lightning mode I'm getting the following error: id value of incorrect type: 001N000001######## But for the ...
4
votes
2answers
1k 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 ...
0
votes
2answers
1k views

Inserting Parent and child records in apex without using external id

I am trying to insert a parent and related child records in same apex execution phase. // code to cretae parent record list List<Parent_Record__c> parentList = new List<Parent_Record__c>(...
0
votes
1answer
10 views

Select most recent “custom object” for a batch of ID

I have a custom object which have a Master relationship towards the Account object and a custom DateTime field. I'd like to select, for each Account, only the custom"Custom Object" with highest ...
4
votes
1answer
229 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 ...
1
vote
0answers
534 views

Why does data loader fail a whole batch of records if just a single master-detail relationship is not filled correctly?

I'm trying to upload records using the data loader. The object I'm loading into has a master-detail relationship, but in the CSV, I don't set any external id or Salesforce id that identifies the ...
3
votes
1answer
145 views

Deleting Permissions from Permission Set

I have build an apex tool which analyzes managed Permission Sets, finds specific permissions and creates a custom Permission Set clone without those permissions. In order to maintain the clones I am ...
0
votes
1answer
67 views

Master and child DML insert not working

I try to insert master and child simultaneously, however, it is not working: public PageReference Submit() { try { insert objectSelected; Id objectSelectedId = objectSelected....
0
votes
1answer
110 views

Master detail relationship query

I have two objects, Opportunity(Master) and Rollout(Detail). I am trying to find Id, Name from Opportunity object who have no record in Rollout object. The id field in Rollout is Opportunity__c.
0
votes
1answer
76 views

Generic Pattern for querying Master-Detail-Records into nested Maps

I'm currently looking for an elegant solution to query all related child-records of all master-objects in a specific trigger and returning them in a nested map that has the master's object id as first-...
0
votes
0answers
48 views

Related List in Master-Detail Relationship [duplicate]

I have the following Master-Detail relationship and would like to get the related Addresses for the Natural Person into a custom Visualforce page using a custom NaturalPersonController so when looking ...
0
votes
2answers
221 views

What fields and syntax for constructor to create records to add to a list<object>

So I'm creating a list of child records for a parent using a loop. Is there a way I can create the child record as I add it to the list instead of creating the object and setting the variables? list&...
1
vote
1answer
216 views

Master-Detail Limitations

We are evaluating the SFSC as an application development platform and have come up with this problem. We need to establish how to overcome the Master-Detail limitations of 2 Detail objects per 1 ...
1
vote
0answers
350 views

Error in change set with MasterDetail relationship even after relationship deleted

I'm getting the following error: Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field I've looked it up online and found out that it (likely) ...
0
votes
2answers
1k views

Create Test data with master detail relationship

I am trying to create a test data for coverage. The field is a formula field and it has a master-detail relationship with another object, then I create a recode in the object. but how can I reference ...
3
votes
1answer
535 views

Create nested records REST API - errorCode “INVALID FIELD”

From the documentation here is what my body looks like for the request. I'm trying to create one parent (SEO__CSEO_Survey__c) and then one child (SEO__CSEO_Survey_Question__c) in a master-detail ...
0
votes
0answers
33 views

Searching Custom Object by Parent account

I have a Custom Object which is related to an Account with a Master-Detail relationship. If I search for the Parent Account Name, I do not find however the Custom Object records. The only solution I ...
4
votes
1answer
956 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.
1
vote
0answers
87 views

Apex trigger Not populating values on lookup field

I have trigger which updates the few master record fields based on the values of the child record. IT_Asset_Management__c is the master object and Employee__c is the detail object. The following is ...
1
vote
2answers
2k views

does sharing applied to child object

I have created custom object in MD relationship and set the master to private . when I Tried to applied sharing rule on Master . It is not effective on child object. does sharing applied to child ...
2
votes
2answers
514 views

Can I feel safe to change a lookup relationship field into master-detail relationship if it is required and cascade deletion

In my scenario, I really want to have a roll-up summary in my master object so I can know which ones doesn't have child objects. Currently it is a lookup relationship which is required and will be ...
1
vote
1answer
971 views

How can I create a hierarchy (parent/child relationship) within the same object?

I have custom object Territory that can have a parent Territory and child Territory. For example, Territory "United Kingdom" with child territories "Scotland", "Wales", "North Ireland" etc. Each of ...
0
votes
1answer
42 views

Error Updating lookup field

I have a use-case where I have to fetch all the meetings available. On selection of one meeting, I have to show the corresponding Attendees. Then I should give an option to display all unrelated ...
0
votes
1answer
203 views

Reparentable Master Detail option of custom field in patch release

I have a custom field in my managed package with "Reparentable Master Detail" option as unchecked. I want to enable this option. Is it possible to do the same with PATCH release of my package? I know ...
0
votes
3answers
71 views

Trying to query Parent using child and another parent matching Parent --> Child --> Parent

I have 3 objects. Event, Invite & Attendee Event - > Invite (one Event to Many Invites) Master Detail relationship Invite has event details Attendee - > Invite (one Attendee to Many Invites)...
0
votes
2answers
39 views

Import Contacts and related records together

Our schema is structured so that Contacts (alumni) can be linked to multiple Accounts (schools) using a custom object, which itself contains a few other fields. We also have other custom objects with ...
0
votes
0answers
477 views

How do I write a test class for master-detail relationship that has trigger-based validation of group membership?

In my org, I have a pair of objects with a master-detail relationship set up and some trigger-based validation as follows:- Both objects contain a picklist field, Business_Segment__c Both objects ...
1
vote
1answer
57 views

Master to detail referencing in query

I have below piece of code where I want to traverse to details from the base query on master object. But I am getting error Like : Error Compile Error: Didn't understand relationship '...
0
votes
1answer
590 views

How to transfer Master-Detail to Lookup conversion from sandbox to production in a change-set?

The message I get is similar to this. I have a Master-Detail relationship(M-D) in Sandbox and production. I need to change M-D to Lookup in Production. I changed in sandbox, then added field to change-...
1
vote
2answers
2k views

How to handle Roll Up Summary type Calculations WITHOUT using Master-Detail

I currently have an object called Opportunities__c with a child object related to it, Opportunities_Forecast__c via a Master-Detail relationship. The Forecast__c object contains two number fields that ...
0
votes
1answer
1k views

Can a master-detail relationship be blank?

I have an object: objectA__c, with 2 master-detail relationships, one to objectB__c and one to objectC__c is it possible to leave one of these relatonships blank? I would like objectA__c to always ...
0
votes
1answer
167 views

Cannot create master / detail / sub-detail relationship

I cannot create a master / detail relationship - have read previous questions and answers on this but couldn't find an answer. The scenario is: Project Payment (custom object) has a master / detail ...
0
votes
1answer
255 views

SOQL to check if there are child records with a certain SystemModStamp or no child records at all

I want to query objects which are in a master-detail relationship. (The query should work without Apex code) The query should return only masters with child records not older than 30 days, or masters ...
0
votes
1answer
59 views

Hyphenated Relationships in Salesforce

I would like to understand the term "hyphenated relationships" in Salesforce. Are these below "hyphenated relationships" in Salesforce? Master-Detail Relationship Lookup Relationship Parent-Child ...
0
votes
2answers
3k views

Why Roll-up Summary is not supported between Account and Contact in Salesforce? [duplicate]

Why salesforce does not support Roll-up Summary on Account for Contact as it is only supporting one standard object which is Opportunity ? I have checked for Roll-up Summary ( https://trailhead....
0
votes
1answer
591 views

External Id issue::: INVALID_FIELD, Foreign key external ID: extid::3073631 not found for field

I'm getting above error message when I try to create child records based on the External Id of the Parent Record. Here is the scenario. Please note that both reference1 and reference2 are related to ...
1
vote
1answer
418 views

Updating an existing Object fails with error INVALID_FIELD_FOR_INSERT_UPDATE

This is the exact error : from smartSync SFLogger ERROR com.salesforce : Sync type:syncUp id:6 FAILED cause:Server call for sync up failed error:Error Domain=CSFNetworkErrorDomain Code=400 "Unable ...
1
vote
1answer
627 views

Easy way to fix reports after changing lookup field to master-detail

Changing a lookup relationship to a master detail breaks all reports and dashboards that are dependent on that relationship. That is a somewhat undesirable result. I was wondering if there is an easy ...
0
votes
1answer
3k views

Master Detail and Roll up summary limits

How many master detail relationships and lookup relationships can we create on an object? (For Latest Salesforce Release)

1 2
3
4 5
7