An exception caused by the addError() method in a trigger on ContentDocument does not show the custom error message
Last updated 2022-02-10 ·Reference W-1801727 ·Reported By 5 users
Summary
An exception caused by explicitly calling the addError() apex method in a trigger on the delete event on ContentDocument is not handled properly when deleting a library via UI, and the custom error message specified in the addError() method is not shown.
- Actual Result
The following message is shown:
Unable to Finish Processing Request
An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact support@salesforce.com. Please indicate the URL of the page you were requesting as well as any other related information. We apologize for the inconvenience.
Thank you again for your patience and assistance. And thanks for using salesforce.com!
Error ID: Data Not Available
- Expected Result.
The custom error message passed to the addError() should be shown as a cause of the error.
Repro
trigger checkAddError on ContentDocument (before delete) {
for(ContentDocument cd: trigger.old){
cd.addError('CUSTOM_ERR_MSG: Cannot delete content ContentDocument');
}
}
Workaround
None
Reported By (5)
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.