salesforce - Attachments in Apex SOQL Subquery -


i have custom objects team member , employment, , there's lookup relationship employment(many) team member(one), plus lookup record on team member called current employment.

the employment record may have attachments.

i want soql query, run in apex class, return attachments information specific team members.

so far have this:

sobject[] results = [select id,(select id,name attachments) employment__c id in (select current_employment__c team_member__c id=:id)]; 

wnen run query in schema browser, works ok , i'm able drill-down attachments, when run in apex (anonymous), result set not contain attachments:

for (sobject result : results) {   system.debug(result); } 

i can see employment id in results.

how can attachments in apex?

you following list of attachment related object.

employment__c[] results = [select id,(select id,name attachments)  employment__c id in (select current_employment__c team_member__c id=:id)];      (employment__c result : results) {    if(result.attachments!=null){        list<attachment> attachmentlist=result.attachments;    } } 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -