-1

I have a trigger that will prevent the user to upload file but the error message in ContentVersion is being overridden by Lightning. How can I create a custom error message?

trigger CDTrigger on ContentVersion (before insert) {
    if(trigger.isInsert) {
        if(trigger.isAfter) {
            for(ContentVersion cv: trigger.new) {
                cv.addError('Sorry, you are restricted to upload a file.'); // Getting a different error if I upload a file
            }
        }
    }    
}

1 Answer 1

1

You can't add Custom error message in Content Related Objects triggers using addError method in Lightning Experience. There is an idea here and worth voting for it: https://success.salesforce.com/ideaView?id=0873A000000lItzQAE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .