1

Can you tell if I am allowed to delete records of big objects? In workbench when I try to delete some records I get a compile error.

database.deleteImmediate([SELECT Id FROM big__b]);

COMPILE ERROR: DML operation Delete not allowed on Legal_Matter__b

3 Answers 3

3

Prior to API 42 (Spring 18) it was not possible to delete rows in Big Object tables. Now you can delete them using the deleteImmediate method of the Database class.

Check out the documentation: https://developer.salesforce.com/docs/atlas.en-us.bigobjects.meta/bigobjects/big_object_delete.htm


Any Apex tests that use DML calls will fail and potentially insert bad data into the target big object. This data won’t be deletable. To test DML calls, use a mocking framework with the Apex stub API to contain calls to the target big object.

Also as mentioned in salesforce documentation main use case for big objects are:

  1. 360° view of the customer — Extend your Salesforce data model to include detailed information from loyalty programs, e-commerce transactions, billing and provisioning information, and more.
  2. Auditing and tracking — Track and maintain a long-term view of your user’s usage of Salesforce or your customer’s usage of your products for analysis or compliance purposes
  3. Historical archive — Maintain access to historical data for analysis or compliance purposes while optimizing the performance of your core CRM or Force.com applications.

So big objects are mostly to be used for auditing purposes. That is the reason they are implemented this way.

3
  • I still cannot delete. I get this error : System.DmlException: Delete failed. First exception on row 0 with id 000000000000000AAA; first error: INVALID_ARGUMENT_TYPE, You must include only the entire set of indexed columns in the example set for entity Booking. No other columns are allowed. : []
    – compski
    Commented Nov 1, 2019 at 8:48
  • @compski you only need to add indexed columns in object. If you are adding more fields it will not allow to delete it. Like if object have index fields as A and B then do Database.deleteImmediate(select a,b from object where a= 'a') ... Don't add any other fields. developer.salesforce.com/docs/atlas.en-us.bigobjects.meta/… Commented Nov 1, 2019 at 15:04
  • I already added all my index fields (where my index fields are A,B,C) but still error : List<Booking__b> b = new List<Booking__b>(); b.addAll([SELECT A,B,C from Booking__b WHERE A= '123' AND B = '234' AND C = '999' Database.deleteImmediate(b);
    – compski
    Commented Nov 12, 2019 at 2:08
1

Looks like it might be coming, see the preview release notes for Spring 18.

Use the Apex method deleteImmediate() to delete data in a custom big object. Declare an sObject that contains all the fields in the custom big object’s index. The sObject acts like a template. All rows that match the sObject’s fields and values are deleted. You can only specify fields that are part of the big object’s index. You must specify all fields in the index. You can’t include a partially specified index or non-indexed field, and wildcards are not supported.

0

You can not delete records of a big objects. This will cause a re-indexing of the big object. However you can completely delete and erase the big object i.e. the definition of a big object.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .