When developing a custom screen that requires both an Account and Contact to be created together, using setSavepoint() and rollback() within a try-catch block is a reliable way to ensure that if the Contact creation fails, the Account creation is also rolled back, maintaining data integrity.References: Apex Developer Guide - Savepoint and Transaction Control