You need to sign in to do that
Don't have an account?
gbrown17
Display attachments in VF page
I'm hoping someone could help me out. I'm trying to display attachments (pictures) in a VF page that are attached to a record. I have searched for a solution on the boards but none of them have seemed to work. Any suggestions? Much appreciated. Thanks, Greg
String curroppid='0064000000AJzIIAA1';
Opportunity oo = [Select o.Name, o.Id, (Select Id, IsNote, Title From NotesAndAttachments) From Opportunity o where o.id=:currOppid limit 1];
List<NoteAndAttachMent> n=oo.NotesAndAttachments;
//process the list for each record to recreate a URL back to the Note or Attachment, or, depending on your need, different URLs for notes and attachments.
If above is what you need pleae mark as solved
All Answers
String curroppid='0064000000AJzIIAA1';
Opportunity oo = [Select o.Name, o.Id, (Select Id, IsNote, Title From NotesAndAttachments) From Opportunity o where o.id=:currOppid limit 1];
List<NoteAndAttachMent> n=oo.NotesAndAttachments;
//process the list for each record to recreate a URL back to the Note or Attachment, or, depending on your need, different URLs for notes and attachments.
If above is what you need pleae mark as solved
Thanks for the feedback - I noticed this is for an opportunity. I actually want to pull attachments from a custom object. What modifications do I have to make to the code to reflect the custom object. Here is what I'm thinking (in bold), let me know if I'm correct...
String curroppid='0064000000AJzIIAA1';
Opportunity oo = [Select o.Name, o.Id, (Select Id, IsNote, Title From NotesAndAttachments) From Opportunity o where o.id=:currOppid limit 1];
List<NoteAndAttachMent> n=oo.NotesAndAttachments;
//process the list for each record to recreate a URL back to the Note or Attachment, or, depending on your need, different URLs for notes and attachments.
Hi Please replace the opportunity id with the record id of your custom object also in query do the same