0

This is not about using ContentType to identify the type of file (.pdf,.doc,.xls etc). This is about identifying which type of company form/document my user has uploaded. For instance, I have an app which manages our external partners. And for those partners we need such things as a govt Regulations Form or a Tax Form.

I would love to be able to identify which type of document a user has uploaded in order for the system to identify what has been obtained and what still needs to be gotten from the partner.

I was thinking that maybe creating multiple Notes & Attachment type of related lists which were specific to the type of forms (ie a Tax Form related list ; a Regulations related list) would do this since I could identify if any of those lists had anything in them. But I don't know if that's feasible.

The only other way I can think of possibly accomplishing this is to prompt the user to check a box indicating the type of document he is uploading. But that isn't really what I'm looking for.

Should I maybe be approaching this with Content instead of Attachments ?

Thank you very much for any feedback.

  • 1
    You may want to consider a custom attachment object that gives you all the flexibility you need. – tobibeer Feb 22 '16 at 14:36
  • How exactly would you go about doing that ? Would you just have an object with one or two fields (used by the user to indicate the type of document) and a Notes & Attachment related list on that object ? And then run some WF to update the main document, indicating what's been filed ? – Zoom_v Feb 22 '16 at 14:58
  • 1
    See above link. – tobibeer Feb 22 '16 at 16:17
  • 1
    @tobibeer - I think that's probably about as good of a solution as I'm going to get. Thank you very much. I really appreciate it. – Zoom_v Feb 22 '16 at 20:38
0

Interesting Question :
I am not sure , but can this be done ?!

Read uploaded files content's :

Let say you are aware that your Regulations Form : First Sentence = "My Regulation Form" or a Tax Form : First Sentence = "This is a Tax form for the year..."

If yes then you can read your file contents by using something like this : (It works for .txt - see if it works for all other files )

    public PageReference readContent() {
    fileContent = fileBody.toString();
     /* your business logic : like here : Compare first line with 
         - accordingly use your business logic  
   */
   }
| improve this answer | |
  • The file types mentioned in the question are .pdf,.doc,.xls which are all binary formats. – Keith C Feb 22 '16 at 16:24
  • 1
    @Nilesh - that would probably be the only way to accomplish it in which the user would only have to upload the file and not have to indicate the type with a prompt (the solution by tobibeer above would require the user to indicate the document type themselves). But I don't see that working for myself because so many of the forms wouldn't have writing in the first line to differentiate. Thank you very much for the input though. – Zoom_v Feb 22 '16 at 20:42

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.