Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How can we insert multiple sObjects in a single DML operation?

    Tagged: Account List in Salesforce, Child Record, DML Operation, DML Operations, Insert, insert Object, Parent Child Record, Parent Record, Salesforce Account, Salesforce Contacts, Salesforce Objects, sObject

    • Salesforce® Discussions

      How can we insert multiple sObjects in a single DML operation?

      Posted by Subhendu on January 15, 2018 at 6:26 AM

      How can we insert multiple sObjects in a single DML operation? What are the limitations that should be considered while doing that?

      Ajay Prakash replied 8 years, 8 months ago 2 Members · 1 Reply
      • Account List in Salesforce
      • Child Record
      • DML Operation
      • DML Operations
      • Insert
      • insert Object
      • Parent Child Record
      • Parent Record
      • Salesforce Account
      • Salesforce Contacts
      • Salesforce Objects
      • sObject
    • 1 Reply
    • Ajay Prakash

      Member
      January 15, 2018 at 6:59 AM

      Hi Subhendu,

      Yes, you can insert multiple sObjects in single DML Operation. Refer below code -

      list<sobject> sObjList = new list<sObject>();
      Account acc = new Account(name='testAcc');
      Contact con = new Contact(lastName ='TestCon');
      sObjList.add(acc);
      sObjList.add(con);
      insert sObjList;

      You can not insert parent and child record both in single DML statement. Ex. In the above sample code, you can not associate a contact with the account being inserted in the same transaction.

       

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Salesforce Nonprofit Success Pack

    Salesforce Nonprofit Success Pack Implementation Guide

    Blog in Salesforce Implementation

    If you’re reading this, you’ve likely decided to begin using Salesforce for your nonprofit organization. Well, have no fear, because you’ve made a great decision!…

    Campaign Members, Campaigns, Case Management, Connector, Contacts
    DB May 17, 2023
    1,384  Views
    Test Classes in Salesforce

    Test Classes in Salesforce - Learn All About it Here

    Blog in Salesforce Apex

    Content   What is a Test class in Salesforce?  What is the need of a Test class in Salesforce?  How to write Test class in Salesforce? …

    Apex Test Class, Assert Statement, Batch Class, Best Practices, Client Requirements
    ABHISHEK SHUKLA Jul 5, 2022
    3,125  Views
    Learn All About the Batch Apex in 2023

    Learn All About the Batch Apex in 2023

    Blog in Salesforce Apex

    The main purpose of using Batch Apex is used to process a large amount of data without exceeding governor limits. It is a type of…

    API Bulk Updates, API Call, Batch, Batch Apex, Batch Apex Class
    saurabh Jan 10, 2023
    2,082  Views

    Popular Salesforce Videos

    Know Why Salesforce Is Secure For Your Business Data

    Know Why Salesforce Is Secure For Your Business Data

    Video in Salesforce Security

    Salesforce.com uses a variety of methods as mentioned in the video - to ensure that your business data is safe, secure, and available only to…

    Salesforce Training, Salesforce Security, salesforce, Salesforce Video, Salesforce Learning
    Neha Yadav Dec 30, 2020
    2,049  Views
    Meet us at Dreamforce23 - Unleash the Ultimate Business Experience!

    Meet us at Dreamforce23 - Unleash the Ultimate Business Experience!

    Video in Events

    Dreamforce 2023 at San Francisco. Save the dates of September 12–14, 2023, and prepare for an unforgettable experience at Dreamforce 2023. Reserve your position by…

    dreamforce, salesforce, Dreamforce Event, tech event, Salesforce VIdeos
    AblyPro Sep 4, 2023
    1,186  Views
    Traditional AI vs Generative AI | What the difference? | Salesforce

    Traditional AI vs Generative AI | What the difference? | Salesforce

    Video in AI and ML, Salesforce Einstein

    Explore how traditional AI differ from Generative AI from this extract from our latest webinar! We're going to explore the strengths and not-so-strong points of…

    Salesforce Training, salesforce, Artificial Intelligence, Salesforce Community, Salesforce Webinar
    Cyntexa Oct 31, 2023
    1,292  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.