You need to sign in to do that
Don't have an account?
Ab
Create Account and contact in one go for test class
Hello,
How is it possible to create a account and contact details in one go
Account accTmp = new account(Name='Something, (new contact(Name = something))
How is it possible to create a account and contact details in one go
Account accTmp = new account(Name='Something, (new contact(Name = something))
Create an external id field in both Account and Contact object . Use same external id value for account and contact to refer the particular account. Try to implement the below code :
Make sure the parent sObject must precede the child sObject in the array(sobj), that is, the array index of the parent must be lower than the child’s index.
Further Information, follow this link : https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_foreign_keys.htm
Thanks
Satya.