You need to sign in to do that
Don't have an account?
krishna reddy Singampalli
DML requires SObject or SObject list type: Contact
public class DML {
public Account acc {set;get;}
public Contact con {set;get;}
public DML(){
acc=new Account();
con=new Contact();
}
public void create (){
insert acc;
con.accountId=acc.Id;
insert con;
}
}
public Account acc {set;get;}
public Contact con {set;get;}
public DML(){
acc=new Account();
con=new Contact();
}
public void create (){
insert acc;
con.accountId=acc.Id;
insert con;
}
}
Hi Krishna,
you can't insert Account or Contact without providing required fields.
Try this code:
Please mark it as Best Answer ,if it helps.
Thanks