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
AbAb 

Notes & Attachments relation with contact object?

Hello,

In the related list of contacts i have "Notes & Attachments" but i dont find this in objects or i dont find any relationship between two objects.
I have duplicated teh contact object, hence i also wanted to duplicate teh relationship.

Thank youf for suggestion !
Best Answer chosen by Ab
Sumit Jain CelebalSumit Jain Celebal
Check this article for more details on how you can add Notes and Attachments related list:

http://help.salesforce.com/HTViewSolution?id=000005118

Regards
Sumit
sumit@celebal.com

All Answers

Adrian  GawryszewskiAdrian Gawryszewski
So we have 3 objects in this scenario: Contact (Parent) and Attachment, Note (Child). It is a lookup relationship between parent and child (1:N) in this case you have to query both child object and match them by ParentId(field on both Child objects) with an Id of a Contact. Then you would have to duplicate those (clone) as well and assign ParentId to that new duplicate Contact object,

Hope that helps
Sumit Jain CelebalSumit Jain Celebal
Notes and Attachments are special types of objects and have polymorphic relationship with other objects. The other objects act as parent for the notes and attachment object.

Notes and Attachments objects contain a field called ParentId and this parentid field can be of any object - account, contact, opportunity, custom object, etc.

Thus, in summary, all the objects can have their notes and attachments data as a child record. I hope this helps.
 
AbAb
I am not also able to find the "Notes and attachments" object?
I wanted to add the lookup on it to my custom object
Adrian  GawryszewskiAdrian Gawryszewski
There are two seperate objects one is called Note and the other one is Attachment. Both are displayed on the same related list. So if you want to query them:

Assuming you have 
Contact contact = [query the contact you want]
//list of notes for a particular contact
List<Note> notes = [select id from note where parentId = : contact.id];
//and for attachments
List<Attachment> atts = [select id from attachment where parentId = : contact.id];

You don't add lookup to custom objects to Notes and Attachments. You simply go to the page layout and from a related lists you and "Notes & Attachments" to it an there it is. You can also select that option when you create a new Object and will be added to a page layout automatically.

Regards
Adrian
Sumit Jain CelebalSumit Jain Celebal
Check this article for more details on how you can add Notes and Attachments related list:

http://help.salesforce.com/HTViewSolution?id=000005118

Regards
Sumit
sumit@celebal.com
This was selected as the best answer
Antoine PierreAntoine Pierre

Dear @[adrian Gawryszewski] or someone who has the information

Could you please reconfirm, that we can not modify the page layout of notes??
indeed for the moment in my org we have just a description field (you can write whatever you want in this field)

I would like to
- add some other description boxes in the note page layout
- or create a new note page layout like below
... is it possible?
User-added image

Thank you in advance,
 BR

Antoine