Created
October 24, 2021 07:56
-
-
Save rahulmalhotra/06eae3f6923cad6d176ef4d67a2e450b to your computer and use it in GitHub Desktop.
This code snippet is used in First error: Insert/Upsert failed. First exception on row 100; first error: INVALID_FIELD, Cannot specify both an external ID reference Parent and a salesforce id, ParentId: [] salesforce tutorial to specify error when we're having both id of the parent object and reference populated as well.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<SObject> records = new List<SObject>(); | |
records.add(new Account(Name='Test Account', Reference_ID__c = 234)); | |
records.add(new Contact(LastName='Test Contact', AccountId = null, Account = new Account(Reference_ID__c = 234))); | |
Database.upsert(records); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment