Activity Forums Salesforce® Discussions What is difference insert() and database .insert() in Salesforce?

  • What is difference insert() and database .insert() in Salesforce?

    Posted by Anuj on April 13, 2020 at 2:28 pm

    What is difference insert() and database .insert() in Salesforce?

    Pooja replied 4 years, 1 month ago 3 Members · 2 Replies
  • 2 Replies
  • Deepak

    Member
    April 13, 2020 at 2:51 pm
    • Insert is a DML statement which is same as Database.insert to insert the record in database. If we use insert DML statement in bulk operation if error occurs in this operation, then execution stop and rollback all the insertion from the database those has been inserted successfully. When error occurs then you can handle this error by try catch block.
    • If we use DML database method (Database.insert) to insert/update record in bulk, then if error occurs the remaining records will be inserted/updated means partially operation will be done.
  • Pooja

    Member
    April 13, 2020 at 2:55 pm

    If we use DML database method (Database.insert) to insert/update record in bulk, then if error occurs the remaining records will be inserted/updated means partially operation will be done.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos