+ Start a Discussion
Gaurav RajGaurav Raj 

Fetching the latest updated document in the Notes and Attachement object



I am writing a trigger to fetch the recently updated document from the Notes and Attachement Object. This document would appear as a link.

May someone help me with how to fetch the link of the document?

Grazitti InteractiveGrazitti Interactive



There are standard SObjects Note as well as Attachment in Salesforce. Simply you can query a record and fetch recently modified record and use it as following-


List<Attachment> a = [select id,Description, ParentId from Attachment order by LastModifiedDate];


List<Note> n  = [select id, ParentId, Title from Note order by LastModifiedDate];


/**If this post helps you, Please throw a kudos by clicking star at right side**/