Is there a way to search attachments that are uploaded to standard Attachment records, attachments only show up in global search if you search by the document name.

Is it possible to search the content of the attachment?

If it is not possible to search an attachment uploaded out of the box then is that possible to do using vf/apex?

  • Why dont you use Files instead of attachments? – Santanu Boral Jan 3 '17 at 22:51
  • can you elaborate little bit more – Nick Kahn Jan 3 '17 at 23:03
  • so the way i setup is that I've added related list (notes & attachments) in my standard page layout. – Nick Kahn Jan 3 '17 at 23:07
  • You can leverage Files related list – Santanu Boral Jan 3 '17 at 23:10

The platform doesn't offer the ability to search the content at present AFAIK.

Apex doesn't include the language features that would allow binary data to be examined and if it did you would need to write a very large amount of code to deal with the many formats that attachments can be in (and that code could easily run into governor limits).

(The .docx format is XML content that Apex could parse but the overall set of folders and XML files are zipped and Apex doesn't expose any unzip/zip APIs.)

Pushing the attachments out to an external indexing service (that supports all the formats you are interested in) and making web service calls to that service to do the searching would be a way to go. But from a quick Google I didn't find a compelling offering either as a ready to use service or as a toolset that you cold setup yourself on e.g. Heroku.

| 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.