Trigger to restrict attachment Size restriction in Salesforce

Sample Trigger:

trigger AttachmentBIUTrigger on Attachment (before insert, before update) {
for(Attachment att : trigger.new) {
if(att.Body.size() > 3145728) {
att.addError('Size cannot be greater than 3 MB');

}
}

Cheers!!!

No comments:

Post a Comment