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
Gaurav RajGaurav Raj 

Fetching the latest updated document in the Notes and Attachement object

Hi,

 

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

Hi,

 

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];

                                  or 

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**/

 

Thanks,

www.grazitti.com