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
MWelch_WTMWelch_WT 

Associating an uploaded image with an sObject

I've got the basics coded for uploading a photo from a VF page into Document, associating it with an sObject (through the hack of putting the sObject's id in the "keyword" field of the document object).  This is all working more-or-less OK.

The problem is all the "clutter" that accumulates in the documents tab for the end user.  I've put the uploaded images in a folder that we will instruct our users to leave alone, but these images show up under "Recent Documents" in the Documents tab, pushing other "real" documents off.

Is there a way to manipulate the "Recent Documents" listing to ignore my uploaded images?  Or, am I completely missing a much more elegant way of uploading images and associating them with an sObject.

Thanks for any input.
Best Answer chosen by Admin (Salesforce Developers) 
MWelch_WTMWelch_WT

I've since discovered the "Attachments" object, which obviously suits my needs perfectly.  Hidden, able to be associated with a parent object, and follows sharing rules.  Perfect.

All Answers

MWelch_WTMWelch_WT

I've since discovered the "Attachments" object, which obviously suits my needs perfectly.  Hidden, able to be associated with a parent object, and follows sharing rules.  Perfect.

This was selected as the best answer
Prajapati.LakhanPrajapati.Lakhan

Hi,

 

I have a similar use case to upload an image for a custom sObject. But I need to upload the image before saving the sobject so that user can see the preview of image before saving its sObject details. Here I realize one problem that attachment cannot be saved before its parent record because its parent id is mendatory field. How can I achive this in SFDC? Can I use a temporary document to upload the image for preview and after that delete it from document and save it to the attachment of the parent  record but this approach will require much stuff to delete the junk documents for every SFDC user .

 

Thanks in advance.

 

Lakhan.