Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulmalhotra/9cc164c64658810afc63fc01612333b7 to your computer and use it in GitHub Desktop.
Save rahulmalhotra/9cc164c64658810afc63fc01612333b7 to your computer and use it in GitHub Desktop.
Gist to insert account and contact record together
List<SObject> records = new List<SObject>();
records.add(new Account(Name='Test Account', Reference_ID__c = 123));
records.add(new Contact(LastName='Test Contact', Account = new Account(Reference_ID__c = 123)));
Database.upsert(records);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment