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
Keith BraneyKeith Braney 

New notes list in visualforce page


We have some custom visualforce pages for custom objects.  These pages have the old "Notes and Attachments" object.  After Winter 2016 was rolled out, our users cannot add notes through this list anymore.  How do I expose the new notes along side the old notes and attachments?  All the documentation I could find said the new notes needs to be added to page layouts, which is straight forward enough, but no instruction on how to do this for visualforce pages.

Code for the old notes and attachments:

<apex:relatedList list="CombinedAttachments"  />

I've tried list="Notes", list="ChatterNotes", and a few others with no luck.  Any help would be appreciated.

Are they getting any error while trying to add note, If yes please share that? Or related list is not visible at all. 
Pete PetersonPete Peterson
I am working with the same issue - I found this file and field reference that may be of some help: 

However, when I try to query some of the files, I receive a message that an 'entity does not support query'. Not much help for giving you a definitive answer, but I thought that the guide might be of some help pointing you in the right direction...
Keith BraneyKeith Braney
Thanks.  @ sushil.grover The error I get is below.  I have changed the customer object name to CustomObject

Visualforce Error: 'Notes' is not a valid child relationship name for CustomObject

Below is the code that created that error (error on line 2).  I don't know the proper reference for the new notes related list, which is where I am having trouble.  

<apex:relatedList list="CombinedAttachments"  />
<apex:relatedList list="Notes"  />

@Pete - thanks for the doc.  I did not find what I was looking for but will keep reading.  Good to know I am not the only one having an issue with this. 
ok. Got it. Object name is ContentNote. Read only junction object name -  AttachedContentNote - where notes are stored per object. 

Here is the tag - <apex:relatedList list="AttachedContentNotes"/>

Pete PetersonPete Peterson
@sushil.grover - I am following this as well - this may be a silly question, but I gotta ask. In the Query Editor of the Development Console, I can query ContentNote, and values are returned. However, I cannot find the object in the Schema Builder, in the Field Reference Guide, or most anywhere else. How do you know about this table? Is there some documentation somewhere that I missed? I am trying to understand how all of these new tables relate (or don't) and can't find the information to do that. Thanks....
@Pete - I just searched Winter 16 release notes pdf. Looked for all new objets containing Note. Yeah its not coming up in Schema buider. 
Pete PetersonPete Peterson
Ok - will give that a try - Thanks much - I appreciate the information!
Keith BraneyKeith Braney
@sushil.grover  Thanks.  I tried adding exactly that as well as some varriations.  Same error.  I am beginning to wonder if the new Notes can be called as as a related list in VisualForce.
Keith - Yeah they have not given that information specifically. When i added it, i am able to see the notes added through standard layout(If i add that new notes related list to standard layout and add some records). But when i tried adding through vf page, it throws invalid session error. So its possible that they did not consider visualforce in mind while developing this. Reacing out to support may help. 
Dan SpencerDan Spencer
Has anyone had any success resolving this?
Brian E MillerBrian E Miller
In Apex Code, the new Notes can be queried via SOQL on these two objects:
  1. ContentNote:
  2. ContentDocumentLink (to relate it to records):
As for seeing the notes in the visualforce page, in the controller, try this query (for an Account record):
SELECT Id, Name, (SELECT Id, Title, TextPreview FROM AttachedContentNotes)
FROM Account
WHERE Id = :myAccountId
See a related post here:!/feedtype=SINGLE_QUESTION_DETAIL&dc=Developer_Forums&criteria=ALLQUESTIONS&id=906F0000000D7FhIAK
Okay, so it's 
<apex:relatedList list="AttachedContentNotes" />

You just need to remember to up your API version to one that supports the new object.
However, the "New Note" button isn't working for me for whatever reason...