+ Start a Discussion
Varun99Varun99 

soql Subquery

Hi,

 

Any one can help how to retrieve customobject attachments using soql query

 

My requirement is

 

Name   Exp  technology  viewAttachment Downloadattachment

xxxx   2yrs    Salesforce  VIEWFILE      document.doc
yyyy   6 yrs    oracle     VIEWFILE      DOC.xlsx  

 

 

Thank you

jd123jd123

Hi

       

    Opportunity oo = [Select Name,(Select Id, IsNote, Title From NotesAndAttachments) From Opportunity ];

 

*rdinakaran**rdinakaran*

Hi,

 

List<Attachment> Att = [SELECT Id , Name FROM Attachment WHERE ParentId = 'a02U0000000wfV5']

 

//"a02U0000000wfV5" is your Custom Object Record ID.

 

Thanks

Varun99Varun99

Hi,

 

Am querying my custom object like

 

for(Advanz__C c:[select name,Experience__C,Technology__C,(Select Id, IsNote,Title From Advanz__C.NotesAndAttachments) FROM Advanz__C ])
{
acclist1.add(c);
}

 

but am getting errog like using that id

 

 

<apex:column headerValue="Attachment">
<apex:outputLink value="{!URLFOR($Action.Attachment.Download, a.id)}" target="_blank" >{!a.name}</apex:outputLink>
</apex:column>

 

 

jd123jd123

Hi

 

     I didn't get you.what error you are getting can you post.

Varun99Varun99

Hi,

 

Am getting this error first time running my page

 

Visualforce Error
 


Invalid parameter for function URLFOR

Error is in expression '{!URLFOR($Action.Attachment.Download, a.id)}' in component <apex:outputField> in page candidateinfo
jd123jd123

can you post a pieace of code. 

 

i think you are not  passing correct id i.e Notes&Attachement id

Varun99Varun99

Hi,

 

 

Thank you for your reply. I got it 

select id,name,Experience__C,Technology__C,(select id,name from advanz__C.Attachments) from advanz__C order by name