0

Is there any way to distinguish between the types of attachments. Essentially I wanted to create a new field on type on the attachments object for distinguishing between pictures, docs and excel etc. Then I want to see the different types of attachments(based on the field) separately on a VF page. Please suggest some ideas.

Thanks

  • 2
    Notes and attachments both are different sobject. – Ratan Paul Feb 16 '16 at 11:01
  • @Ratan Talking about attachments. Thanks for pointing it out. – Prajith Feb 16 '16 at 11:04
  • 1
    Ohh are you looking for Type of attachment like doc image pdf etc? So you can use contentType field on Attachment.... Sorry your question was bit confusing – Ratan Paul Feb 16 '16 at 11:26
  • @Ratan Thank a lot and I agree on the confusing part. – Prajith Feb 16 '16 at 15:24
  • 1
    @Ratan Yeah decided to go with ContentType for now. – Prajith Feb 16 '16 at 15:28
1

Yes you can use ContentType on attachment to difference between their file extension. According to the docs

ContentType Type string

Properties Create, Filter, Group, Nillable,Sort, Update

Description The content type of the attachment. If the Don't allow HTML uploads as attachments or document records security setting is enabled for your organization, you cannot upload files with the following file extensions: .htm, .html, .htt, .htx, .mhtm, .mhtml, .shtm, .shtml, .acgi, .svg.

Attachment Reference

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.