I would like to implement a service that takes a lastModifiedDate as input and returns all ContentNote records which were modified after the given lastModifiedDate. The service response should have the following fields
Is there a way to implement this with as few queries as possible?
Notes are just content documents ("Files") with special type. This might give you some ideas?
SELECT Id, Title, LatestPublishedVersion.VersionNumber, LatestPublishedVersion.VersionData,
(SELECT LinkedEntityId, LinkedEntity.Name FROM ContentDocumentLinks)
FROM ContentDocument
WHERE FileType = 'SNOTE'
AND LastModifiedDate = LAST_N_DAYS:7