You need to sign in to do that
Don't have an account?

Get last Contract Note in a trigger (Content Note)
HI,
I am just trying to get last added / updated note (Content Note) on a contract.
I tried triger on Content Note(not supported), ContractFeed (Not supported), Content Version (Parent id is not present), Feed item (Content is not present)
What is the relataionship I can use to get
1) parent id
2) title of note
3) body of note
Code tried : This returns NULL
Ann
I am just trying to get last added / updated note (Content Note) on a contract.
I tried triger on Content Note(not supported), ContractFeed (Not supported), Content Version (Parent id is not present), Feed item (Content is not present)
What is the relataionship I can use to get
1) parent id
2) title of note
3) body of note
Code tried : This returns NULL
trigger tgrGetContractNotes on FeedItem (after insert, after update) { for(FeedItem f : Trigger.new){ system.debug('#Contractid#'+f.ParentId); system.debug('#rel#'+f.RelatedRecordId); ContentVersion cV = [Select ContentDocumentId from ContentVersion where id= :f.RelatedRecordId limit 1]; ContentNote cN = [Select TextPreview,Title from ContentNote where id =: cv.ContentDocumentId limit 1]; system.debug('#notetitle#'+cN.Title); system.debug('#notebody#'+cN.TextPreview); ContractFeed cF = [Select title, body from ContractFeed where parentid = : f.ParentId limit 1]; system.debug('#notebody#'+cF.title); system.debug('#notebody#'+cF.body); } }Thanks
Ann
Are you looking for the NOTE object? Looking at your fields and request, I'm thinking you are. Try [SELECT Id, Title, Body FROM Note WHERE ParentId = :yourRecordId]