function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
omkar shirke 1omkar shirke 1 

how to restrict .xls file upload attachment in a custom object?. A sample code could be very useful...Thanks in advance

Raj VakatiRaj Vakati
You need to write a trigger .. here is the sample code
 
public static final List<string> CONTENT_TYPES = new string[]{'image/gif','image/png','image/jpg'};

for(attachment a: Trigger.new)
{
   if (!isAllowedContentType(a.ContentType)) {
       a.addError('only allowed jpg, gif, png files');
   }    
}
 
Raj VakatiRaj Vakati
Refer this link 

https://salesforce.stackexchange.com/questions/121123/how-to-restrict-file-type-in-standard-page-attach