More About DML
Here are some things you may want to know about using Data Manipulation Language.
-
You can specify DML options for insert and update operations by setting the desired options in the
Database.DMLOptionsobject. You can setDatabase.DMLOptionsfor the operation by calling thesetOptionsmethod on the sObject, or by passing it as a parameter to theDatabase.insertandDatabase.updatemethods. -
Read about transaction requests, generating and releasing savepoints, rolling back transactions, and more.
-
sObjects That Can’t Be Used Together in DML Operations
DML operations on certain sObjects, sometimes referred to as setup objects, can’t be mixed with DML on non-setup sObjects in the same transaction. This restriction exists because some sObjects affect the user’s access to records in the org. You must insert or update these types of sObjects in a different transaction to prevent operations from happening with incorrect access-level permissions. For example, you can’t update an account and a user role in a single transaction.