According to salesforce docs on savepoints and rollbacks:
Apex gives you the ability to generate a savepoint , that is, a point in the request that specifies the state of the database at that time. Any DML statement that occurs after the savepoint can be discarded, and the database can be restored to the same condition it was in at the time you generated the savepoint.
When it says any DML statement that occurs after the savepoint, does it mean within that transaction, or across all changes that might have happened?
Also, is the manual savepoint the same as the automatic rollback on exception?
I have a future method making a callout that is then updating records - at the moment the entire method is wrapped in a 'try catch' which I assume will stop rollbacks from happening (the catch currently sends an email in the event of failure and records are manually updated).
If I were to get rid of the email and remove the try catch, or rethrow an exception, or add a savepoint and revert manually, is there a danger that this might revert changes made in the meantime by other transactions?
@future(callout=true)
public static void retrieveAndProcessContactData(String contactCode) {
try {
contact retrievedCon = getContact(contactCode);
if (retrievedCon != null) {
createOrUpdateContact(retrievedCon);
}
} catch(Exception ex) {
processingExceptionEmail(ex, 'contact processing failure', contactCode);
System.debug('ERROR:');
System.debug(ex);
}
}