You need to sign in to do that
Don't have an account?
German Mejias 7
AfterInsert Trigger on ContentDocumentLink addError not working
In Apex using a AfterInsert Trigger over ContentDocumentLink (cdl) object, the method cdl.addError ('Custom message') is not working as expected.
According to standard documentation https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm using a cdl.addError ('Custom message') should show a custom message error to the user (Standard lightning component Notes)
This is not the case. Instead the error that is showing is just standard error that provide no information to the user.
According to standard documentation https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_contentdocumentlink.htm using a cdl.addError ('Custom message') should show a custom message error to the user (Standard lightning component Notes)
This is not the case. Instead the error that is showing is just standard error that provide no information to the user.
trigger cdlTrigger on ContentDocumentLink (after insert) { for (ContentDocumentLink cdl : trigger.new) { if (!CDLHelper.isSharingAllowed(cdl)) { cdl.addError('Sorry, you cannot share this file.'); } } } public class CDLHelper { public static boolean isSharingAllowed(ContentDocumentLink cdl) { return false; } }
Hi, I'm having the same problem. The lightning UI simply displays "Can't upload <fileName.ext>."
Have you found a workaround?