Are Custom Settings included in a Database.rollback()?

Apex has a Transaction Control system for rolling back changes to SObjects. Are Custom Settings included in a rollback? (To be more clear, are Custom Settings reverted to the state that they were in when setSavepoint() was called?)

Answer

Yes, they are. In fact changes you wouldn’t think of as DML are also rolled back: calling @future method, sending email, and others. In essence outside of the current apex state rolling back undoes EVERYTHING you did.

Note that Big Objects are the exception to this, they commit immediatley and do not support rollbacks. Even in tests.

Platform events are also not able to be rolled back (but don’t fire real event handers form tests like Big Objects do)

Attribution
Source : Link , Question Author : edgartheunready , Answer Author : ca_peterson

Leave a Comment