19

This is a recent issue with Salesforce. To workaround this issue, please add the master detail field (even if it has not been changed) to your deployment and the error will go away. I have already filed a Case with Salesforce and they are working on it. Thanks, sridhar Salesforce knowledge article link https://help.salesforce.com/articleView?id=...


16

One of the issues with an explicitly delete of all the child records is that there may simply be too many of them. I've seen instances where a master object has more than 10,000 detail records, and if you're doing a mass delete of parents with high numbers of children that would eat through your DML rows limit very quickly. While it's conceptually simpler ...


16

Do not use SOQL unless you must. If all the data you need to update comes from the child, simply use it sans query. Save governor limits wherever possible in your code. Opportunity master = new Opportunity(Id=detail.Opportunity__c); // child related data update master; Sometimes you actually need parent data, and that is how you should decide when a query ...


15

From the Salesforce documentation: Considerations for Relationships Converting Relationships You can convert a master-detail relationship to a lookup relationship as long as no roll-up summary fields exist on the master object. You can convert a lookup relationship to a master-detail relationship, but only if the lookup field in all records ...


14

The statement is ambiguous when read and re-read carefully. "Desired operation" may refer to calling the business logic, or it may refer to simply calling a DML statement (as your DRY example). I personally follow the second method, because it not only simplifies your code, but also reduces the number of paths one has to scan through when a logic bug or ...


13

A lookup (with Delete this record also) and master-detail share a large number of similarities: Deletion of the related record causes a cascade delete that does not invoke triggers. Both types of relationships are automatically indexed. There are some trivial differences: Lookups are not required by default, where master-details are always required. ...


13

I can't offer you any insight into why you cannot do this, you just can't unfortunately, it's a seemingly arbitrary limitation of the platform and the Product2 object. Unless someone who knows about the internals of the platform comes across this I doubt you'll ever get a definitive answer. In terms of working around it though, the only way to achieve this ...


11

This statement As a best practice, don't exceed 10,000 child records for a master-detail relationship. Refers to record relationships, thus it is refering to a parent record with the number of related child records not exceeding 10,000. Thus it means 'per Master' record.


11

Based on the workaround from Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field: Workaround: Add the master-detail lookup field to the deployment (even if it has not changed) to your deployment selected list. it looks like the problem is that sfdx fails to push the master-detail relationship ...


10

A change to the value of the roll-up summary field on the master/parent triggered by a change on the detail/child's field that feeds into the roll-up summary should fire the workflow rule on the parent. The parent roll-up summary will be affected when the child value changes. For example, if you have a blank in the child field value and it stays blank the ...


8

This is due to how Master-Detail security is setup. Detail objects inherit permissions from their Master. If the record owner does not have Edit on the Opportunity they will not be able to add any Detail records, including your Component. There are two things you can try: Add or alter your sharing rules/profiles to give owners the permissions they need ...


8

You are trying to traverse multiple levels in a Parent-to-Child query. From the documentation In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specified Account, the SELECT clause could only specify the Contact or other objects at that level. It could not specify a ...


8

Your only option is changing the Master-Detail relationship to a lookup. In a Master-Detail relationships, according to the documentation: The detail record inherits the sharing and security settings of its master record. To retain the same features of a master detail you'll want to mark the lookup as required and and set it up to delete the child ...


8

Yes, this is a known issue. Mark Pond is correct, our information in that unit on Trailhead is inaccurate. You can convert as long as there are no RSF fields. https://help.salesforce.com/HTViewHelpDoc?id=relationships_considerations.htm&language=en_US We've got the fix teed up and ready to go in our next release.


8

Okay this is how I resolved it. Based on the Metadata Field Types I set the sharingModel and the externalSharingModel both to ControlledByParent and everything built correctly! EDIT When I tried pushing to the newly created scratch Org I got this error Cannot set sharingModel to ControlledByParent on a CustomObject without a MasterDetail relationship field....


7

The 10k children record recommendation is performance related because of data skew in large data volumes and the impact of inspecting all of those child records when computing sharing visibility. Force.com Engineering - Extreme Force.com Data Loading Part 1: Tune Your Data Model


7

Also you can directly query in child object using relationship fields, [select ISOOffice__Merchant_Location__c,Account__r.Name from ISOOffice__Merchant_Opportunity__c where ISOOffice__Opportunity_Type__c = 'New Merchant' AND Account__r.Name = 'Goodwill of Southwestern Pennsylvania'] You need to prefix ISOOffice__Merchant_Location__c with Account__r, ...


7

I see two reasons if we use look-up instead of master-detail type relationship: When you delete parent records, its child records will not be deleted. In case you delete both parent records, that linker record will be an orphan record and will eat your expensive storage. You will require an extra mechanism/components to trace those type of records. Security ...


7

There are following issues in your design. Account data skew: If an Account record has more than 10,000 child records then it is called Account data skew. It can also be broadly called as Parent-Child data skew. So, any updates to a single child record, Salesforce locks the parent Account which is called Record level locking. Now if you try to update child ...


6

It does not have to be defined on the child and the parent. The child will have the actual account relationship field (e.g., Account__c on your custom object, or whatever your child record is). The Account will have the External ID that identifies it. The child load file will then have the external ID in it instead of the Account ID. This is one reason ...


6

This is a many to many object model which will utilize a 'junction object'. Employing a pair of lookups defined on the junction object with a structure that looks like this: Author (Contact) <-- lookup Paper_Author__c lookup --> Paper__c This model supports an Author on many Papers as well as a Paper having many Authors. It also will give you the ...


6

You don't need apex at all! Create a new visualforce page with a standard controller based on your object In this page create an apex:pageMessage Set render criteria basen on some field Add this page to the object layout Visualforce page: <apex:page standardController="Account" sidebar="false" showHeader="false" ...


6

They are a unique category of fields commonly referred to as standard lookup fields. Unlike custom lookup fields, they have the generally have the "cascade deletion" property set to true, and unlike custom master-detail fields, they may have the "always required" property set to false. Also, these fields can restrict deletion of accounts when certain ...


6

Primary points in choosing MDR over lookup should be: Does it make sense? Think about structure. What do the objects represent? When you insert a cObj2 does it depends on the related cObj1? Roll-up summary. More often than not this is the cornerstone of my decision. Will you need (at any moment) to count, sum or loop through the child object? Deleting ...


6

Just create a custom field on the parent object using the rollup summary data type. The field creation wizard will walk you though it. Create a formula field on the child "Total Amount" (quantity * unit price), then sum the formula.


6

If you would read the description of a Master-Detail field, you would notice the following: Creates a special type of parent-child relationship between this object (the child, or "detail") and another object (the parent, or "master") where: The relationship field is required on all detail records. The ownership and sharing of a detail record ...


6

You can do it via serialization if you want to go that far: class Proxy { final List<Child__c> records; Proxy(List<Child__c> children) { records = children; } Integer totalSize { get { return records.size(); } } Boolean done = true; } List<Child__c> children = new List<Child__c> { new Child__c(Name='Demo') }; String ...


6

The OwnerId value from the Master record is used to set the value of the OwnerId on the child records when the relationship is changed from Master-Detail to a Lookup. Additionally, the Org-Wide defaults for the child object are used to set the sharing on the child records. This usually needs to be reviewed after converting the field type to ensure that the ...


6

By default, the system is limited to 40 lookup fields per object, up to two of which may be master-detail relationships if it is a custom object. You can request more than the 40 relationship per object limit if absolutely necessary, although there are performance implications for doing so. The absolute limit that you can request is 50.


5

Warning: Looking at your code in your controller you are doing a for loop in Apex to attempt pause the execution, i would not recommend this, as its not a reliable way to pause the execution and will (for now) use up the statement governor quickly. My example below uses the MetadataCreateJob class, to use Batch Apex to handle the async aspect of the ...


Only top voted, non community-wiki answers of a minimum length are eligible