This is a long shot, as I've already gone a fair bit of googling, but wanted to check with the Stack community to cover all my bases.
Scenario: Our reps sometimes have to 'Cancel' events and remove them from their Calendar, and sometimes other users (front desk) need to cancel events for anyone in the business, on behalf of the customer if they call to cancel.
We also want to track Cancellation History for each account, and allow for people to cancel for one another - so we can't use the normal delete button due to Role Hierarchy security getting in the way of people deleting for other people.
So, I built an Apex trigger and class method that checks to see when the status of an Event is first set to "Cancelled" (after update), and then it copies/inserts all relevant Event data into a custom object called Cancellation_History__c and deletes the Event that was just marked as "Cancelled".
Problem/Question: When a user edits the Event record and marks it as "Cancelled", obviously that triggers the Apex which, in turn, deletes the Event record that was just modified. Since the user just saved/updated that record, Salesforce standard behavior wants to redirect them to the record that they just updated. However, Apex has already deleted that record, which results in the user reaching the "Record Deleted" page.
Can I somehow improve this user experience, by rerouting them programmatically to the account page instead of the standard behavior of trying to load the record that was just deleted?
I'm happy to provide code if requested, but I don't think it is relevant to the question itself so I excluded it. We currently use standard Salesforce page layouts (not VisualForce pages), but if there is a solution that exists through VisualForce I'd be happy to hear it also.
Thanks for your time!