function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
The simplest way to achieve this is to insert the parent, then set the lookup relationship id on the child to the parent record id, as follows:
Account acc=new Account(Name='Blog Acc1');
insert acc;
Contact cont=new Contact(FirstName='Bob', LastName='Buzzard', AccountId=acc.id);
insert cont;
Also you can refer:http://bobbuzzard.blogspot.in/2012/03/create-parent-and-child-records-in-one.html
Thanks,
Shruti Khodabole
Salesforce Developer
http://www.zen4orce.com
All Answers
The simplest way to achieve this is to insert the parent, then set the lookup relationship id on the child to the parent record id, as follows:
Account acc=new Account(Name='Blog Acc1');
insert acc;
Contact cont=new Contact(FirstName='Bob', LastName='Buzzard', AccountId=acc.id);
insert cont;
Also you can refer:http://bobbuzzard.blogspot.in/2012/03/create-parent-and-child-records-in-one.html
Thanks,
Shruti Khodabole
Salesforce Developer
http://www.zen4orce.com
Here is the link https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_foreign_keys.htm
Thanks,
Sukanya Banekar