Insert Bulk Accounts and 5 Contacts to Each Account Post author:Swapnil Jaiswal Post published:January 5, 2025 Post category:Blog / Salesforce Post comments:0 Comments Code Snippet to Bulk Insert Accounts and 5 Contacts to Each Account. Execute the below script in developer console. It will create 5 Accounts records and each Account have 5 Contacts. For(integer i=0; i<5; i++) { Account acc = new Account(Name='Bulk Account '+i, AccountNumber='919102'+i, Rating='Hot'); Insert acc; For(integer j=0; j<5; j++) { Contact con = new Contact(LastName=acc.Name +' Contact '+j, AccountId=acc.Id); Insert con; } } You Might Also Like LWC Project: Update Parent Records from Child Page. October 25, 2024 Bulk Insert Accounts, add 5 Contacts to Each Account and 2 Opportunity for each Contact January 5, 2025 Dynamic Progress Indicator In LWC July 7, 2024 Alept Consulting – Salesforce Developer Interview Questions September 26, 2024 L&T – Salesforce Developer Interview Questions September 24, 2024 LWC Intermediate Quiz – 15 Questions on Lightning Data Service, Events, LMS & More September 16, 2026 Leave a Reply Cancel replyCommentEnter your name or username to comment Enter your email address to comment Enter your website URL (optional) Save my name, email, and website in this browser for the next time I comment.
Bulk Insert Accounts, add 5 Contacts to Each Account and 2 Opportunity for each Contact January 5, 2025
LWC Intermediate Quiz – 15 Questions on Lightning Data Service, Events, LMS & More September 16, 2026