Newer Version Available
deleteByExample()
Use deleteByExample() to delete big object data from your org using an sObject as a template for what to delete. All data in a big object matching the values in the sObject templates are deleted.
Syntax
Rules and Guidelines
- Your client application must be logged in with sufficient access rights to delete individual objects within the specified object. For more information, see Factors that Affect Data Access.
- You can't delete records for multiple object types in one call if one of those
types is related to a feature in the Setup area in Salesforce. The only
exceptions are the following objects:
- Custom settings objects, which are similar to custom objects. For more information, see “Create Custom Settings” in the Salesforce Help.
- GroupMember
- Group
- User
Basic Steps for Deleting Data
Deleting data involves the following basic steps:
- Define an sObject using all the fields that make up the index of the big object.
- Specify the values for each field.
- Call deleteByExample(), passing in the sObject you created.
- Process the results in the DeleteByExampleResult[] to verify whether the records have been successfully deleted.
Sample Code—Custom Big Objects
This sample shows how to delete records in a custom big object. In this example, Account__c, Game_Platform__c, and Play_Date__c are part of the custom big object’s index. All rows where Account__c is “001d000000Ky3xIAB”, Game_Platform__c is “iOS”, and Play_Date__c is “2017-11-28T19:13:36.000z” are deleted.
Sample Code—Field Audit Trail
This sample shows how to delete records in FieldHistoryArchive. All rows with the specified criteria are deleted.
Arguments
| Name | Type | Description |
|---|---|---|
| sObject | sObject[] | Array of one or more sObjects to use as templates for deletion. |