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
samrat.1985@lntinfotechsamrat.1985@lntinfotech 

Can we access documents attached to a record via API

Hi i have been trying to access a document attached to a record using API calls. CAn i really do that?

Please help me as a major functionality is hanging on this particular issue....

Thanks

ForceMantis (Amit Jain)ForceMantis (Amit Jain)

Sure you can. Query the Attachment object specifying 'ParentId' in Where clause.

 

Id parentId;
List<Attachment> myAttachment = [Select ParentId, Id, ContentType, Body From Attachment Where ParentId =: parentId];

 This will return you a list of attachment.