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

Custom Objects: Lookup relationships to self

I just want to confirm that I can not create a Custom Object and then define a lookup relationship to that same Custom Object (to create a hierarchical relationship, for example). An example might be a Custom Object called "Folder" which has a lookup relationship called "Parent Folder" of type "Folder".
Have you tried? Yes, you can. I used a Master lookup for Parent to children and a simple lookup for children to Parent. It was a bit tricky, but I finally got it so I can see the Parent and the children when I am looking at the Custom Object layout. I also had to play around with Labeling until I got it right. So pay careful attention to the description sfdc shows on each page of the Custom Object wizard.
Yes I have tried. When I try to create a master-detail or lookup relationship, the dropdown list of custom object choices doesn't list the "current" custom object, thereby eliminating my ability to define a relationship back to itself.

An example would be a custom object called MyFolder. When you get to the "Related To" dropdown, "MyFolder" doesn't show up.

Message Edited by Flash on 02-14-2006 10:13 AM

Sorry, I mis-spoke. What I actually do is create another Custom Object, that's a link object (at least, that's what I call it). I create the Master and the lookup relations in this link object. And sfdc doesn't remove them from the lookup relationship, if you have already used an Object for the Master lookup. So you don't experience a conflict there. Now you can display the link object on the 'Folder' Custom Object layout and it'll appear as if you can see the parent/children.
The "link" object approach is the closest approximation to a self relationship that we currently have. You have effectively created a many-to-many self relationship rather than a parent-child self relationship.

The downside to the many-to-many approach is that you have to deal with 2 related lists and the link records that associate the two "parents" are not automatically maintained in both directions.

We are planning to add a self relationship in the future. It will probably be a lookup relationship (optional FK), rather than master-detail (required FK).

Eric Bezar
Platform Product Management
Hmm, I don't have to maintain two lists. I add a child (Object 2) to Object 1, and the parent immediately shows up in Object 2 layout. I did have to do some tweaking with the layout to make this happen. I'm not so sure I can reproduce that tweaking any more :).

I suppose I can have multiple Parents. After some more thought, it so happens I want that in my case.
I'm trying to do the same thing - any idea when this feature will be available?