function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sai manojsai manoj 

how to write a apex program to insert list of account with list of contact method as parameter

-Input - list of accounts, list of contacts
-action- save in database

if record of account and corresponding contact has been failed that record has not insert
Note  -- create method signature-(method with parameters) as list of accounts and list of contacts parameters - list<Account>accts, list<contact>conts 
---- Create save point
insert accounts from parameter
insert contacts from parameter
 -- roll back in case of exception
please give any guidance if any one know
Raj VakatiRaj Vakati
Use this code
public class savePointExample {

  public void savePointRollBack(List<Account> accList , List<Contact> conList) {
	 Savepoint sp = Database.setSavepoint();
     insert accList;
     insert conList;
   } catch(DMLException exc) {



sai manojsai manoj
Thanks Raj for this i want to write apex trigger for this which events i want to use
please guide me