Newer Version Available
sObjects That Don’t Support DML Operations
Your organization contains standard objects provided by Salesforce and custom objects that you created. These objects can be accessed in Apex as instances of the sObject data type. You can query these objects and perform DML operations on them. However, some standard objects don’t support DML operations although you can still obtain them in queries. The following is a non-exhaustive list of such objects:
- AccountTerritoryAssignmentRule
- AccountTerritoryAssignmentRuleItem
- ApexComponent
- ApexPage
- BusinessHours
- BusinessProcess
- CategoryNode
- CurrencyType
- DatedConversionRate
- NetworkMember (allows update only)
- ProcessInstance
- Profile
- RecordType
- SelfServiceUser
- StaticResource
- Territory2
- UserAccountTeamMember
- UserPreference
- UserTerritory
- WebLink
The following are special cases of DML operations on objects.
- If an Account record has a record type of Person Account, the Name field can’t be modified with DML operations.
- All standard and custom objects can also be accessed through the SOAP API. ProcessInstance is an exception. You can’t create, update, or delete ProcessInstance in the SOAP API.
- DML operations aren't supported on Data Cloud data model objects (DMOs). For details on using Apex with Data Cloud objects, see Data Cloud in Apex.
- To determine if DML is supported on your specific object, use the Schema.describeSObjects()method as shown in this
sample code.
1// This example describes the ApexPage object. Replace it with your 2// objects(s) in the results list to check if DML is permitted. 3List<Schema.DescribeSobjectResult> results = Schema.describeSObjects(new List<string> {'ApexPage'}, SObjectDescribeOptions.DEFERRED); 4DescribeSObjectResult d = results[0]; 5System.debug('isCreateable():' + d.isCreateable()); 6System.debug('isUpdateable():' + d.isUpdateable()); 7System.debug('isQueryable(): ' + d.isQueryable());