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
nagalakshminagalakshmi 

how to retrieve parent field from attachments

Hi,

 

how to retrieve parent object field from attachment query..

 

Thanks,

Lakshmi

SFDC_LearnerSFDC_Learner

Through parentId we can get the value ...

souvik9086souvik9086

Through parentid. It is a polymorphic field. See the below link to which objects it is related.

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_attachment.htm#topic-title

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

sandeep@Salesforcesandeep@Salesforce

Lets say your Attachment id is 'XXXXXXXXXXXXXXX' and you can fetch parent id like below

String ParentID ;

for(Attachment Atc : [select ParentId from Attachment where id = 'XXXXXXXXXXXXXXX' ])

{

     ParentID = Atc.ParentID ;

}

system.debug('========ParentID ========'+ParentID );

nagalakshminagalakshmi

Hi,

 

Thanks for replys. Actaully attachment able to store all object attachements right? but i need to display only one custom object attachments and i have in that parent custom object one date field is available. i need to display date field of parent in vf page. Please let me know the way. 

 

 

Thanks,

Laskhmi

vpmvpm

Hi,


Refer this link. I'm not able to understand your scenario.Can you explain this?

 

http://boards.developerforce.com/t5/Visualforce-Development/how-to-get-ParentID/m-p/652981#M67107

chakib lemkhantarchakib lemkhantar
Hi,
did you find the solution ? I have the same issue :(