Custom error messages not displayed in Lightning Experience when uploading files
Apex , Content and Files , Summer 17
Last updated 9 days ago ·Reference W-4807698 ·Reported By 223 users
In Review
Summary
Server error messages (added via addError() for instance) are not displayed in various scenarios (e.g. file upload) in Lightning Experience. They are displayed as expected in Classic.
Repro
1) Create an Apex trigger named 'AttachmentTriggerForInsert' on ContentDocumentLink object as following:
---
trigger AttachmentTriggerForInsert on ContentDocumentLink (after Insert) {
for(ContentDocumentLink obj : Trigger.new){
obj.addError('Test message! You can not upload the file!!!');
}
}
---
2) Switch to Lightnig Experience if necessary
3) Go to "Files" tab
4) Click "Upload Files" button and choose any file to attach.
You will see "Can't upload [Your uploaded file name]." error message instead of seeing 'Test message! You can not upload the file!!!' set in 'AttachmentTriggerForInsert' Apex Trigger. Note this message is below the uploader progress bar.
In Classic, the custom error message is expected.
Workaround
If the org has some record types on ContentVersion, errors will be displayed in the "Add File Details" panel, where the user will see "Enter details on next page", instead of "Can't upload file".
Multiple file uploads were introduced in Summer '17 (https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_files_related_list_drag.htm). This functionality is available in the following scenarios:
1. [Desktop only] Files home
2. [Desktop only] Files/Notes and Attachments related list
3. [Desktop and Mobile] lightning:fileUploader component
In these places, the component returns a hard coded error message (i.e. "Can't upload") instead of a custom error message set for instance via addError().
Reported By (223)







































































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.