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
Iceman123Iceman123 

Relate records within the same object

Hi there,

 

We are trying to implement a new custom object to store product defects.  We have 1 requirement we are not sure if it requires customization.  The specific requirement is the following:

 

- The ability to relate product defects to each other (ie. records within the same object) by selecting existing defects in the system.

- A *single* related list (eg. "Related Defects") on the product defect layout to show all "linked" product defects, eg. if DefectA is linked to DefectB and DefectC, DefectA's related list will show B and C, DefectB's related list will show A and C, and so on.

 

Can this be done without customization?

 

thanks

prats23prats23

Yes, it can be done without customisation.

 

You need to create a self-referential lookup field i.e. a lookup field to "Defects" and give name of Related List Label as "Related Defects"

 

Hope this helps!

 

Iceman123Iceman123

Thanks for the feedback. I actually tried this approach.  Unfortunately, it does not satisfy requirement #1 fully because the related list from this self lookup only offers a New button (ie. the user will have to create a new defect as part of creating this relationship).  In most cases, we will be associating existing defects.  Is there a way to have this self look up provide a search for/add existing button? :)  

prats23prats23

Well, I fear no!

 

there is no out-of-box functionality to search relared records to add to a related list. You will have to create a custom button to Search / Add related records.

 

But, the customisation is going to be pretty straight forward, probably use inline Vf and controller :)

Ritesh AswaneyRitesh Aswaney

Not sure I completely follow this discussion, but here's my £0.02

 

If  you have a lookup field (self referential or otherwise), you can pick the object you want to relate to from the standard salesforce screen. There is no compulsion to create it from the related list of the object it looks up to.

Lets take Account and Contact. You can create a new Contact from the related Account screen, as well as the Contact tab.

 

If an object A looks up to an object B, then A will auto appear in the related list on B, if the related list for A has been added to the Page Layout for Object B.

prats23prats23

Well,

 

What I understood is : A "record search" functionality over the header of Related List, so as to directly search (As a lookup) and attach to the list.

 

It is not only about creating (or adding lookups) from ant object detail page / related list tab. I guess, IceMan can explain better his requirement..

 

P.S. I hit almost the same problem, while creating a search functionality for Solutions in some other object..

Iceman123Iceman123

"A "record search" functionality over the header of Related List, so as to directly search (As a lookup) and attach to the list."

 

Yep, this is the right description of the requirement.  Currently, the related list produced from adding a lookup to itself only provides a "New" button, which meant that you will actually be creating new defects to associate to this record.  But what we are looking for is the ability to associate *existing* defects to the record via the related list.  It sounds this will have to be customized.

 

thx

Iceman123Iceman123

What I also realized is that the simple self-lookup only displays the related record in the related list of the original record.  I mean is, say I have Record A, and I added a related record (Record B) via the related list.  The related list section for Record A shows Record B, but when I look at Record B's related list, it does not show that it is related to Record A.  So it looks like a need a connector object and can't simply use a self lookup here.

 

The end goal here is to link up all related records within the same object, eg.  

Record A is related to Record B and C.  On each Record's related list, it should show the other 2 records (eg. On Record A's related list, to show B and C, on Record B's related list, to show A and C, and on Record C's related list to show A and B).

 

I can certainly implement a custom object to with custom fields to store the relationship between these keys and have a VF page display their relationships accordingly.  Just want to check here to see if anyone has implemented this without customization :)

 

thanks

 

 

mysteriousauramysteriousaura

Did you ever figure out if this can be done without customization?

Suvajit Majumder 20Suvajit Majumder 20
Hey Iceman,

Were you able to implement this functionality? If Yes, can you help me in that case as I have exactly same requirement?
 
Suvajit Majumder 20Suvajit Majumder 20
Or anyone implemented this functionality , can you help me to implement the same?
Krista Frank 5Krista Frank 5

I've got a couple very similar situations. One which has been set up is for "Overlapping Parcels", when two Parcels overlap each other. The way it is currently set up, I end up with two separate related lists on the Parcel object detail page for "Base Parcel" and "Overlap Parcel". Not ideal, but what I have. What I WANT is to have a single list, exactly as described here, so that when Parcels 1 and 2 overlap, when viewing Parcel 1, I see Parcel 2 in the Overlapping Parcels list, and when viewing Parcel 2, I see Parcel 1 in the list. This solution uses a separate Overlapping Parcels object with two separate lookup fields to the Parcel object, one for Base, one for Overlap. This is functional, but having the two separate lists is a pain. 

I now need to do a very similar thing with another record, where I really just want two indicate that two records of the same object are related to one another, exactly as Iceman wanted to do with his defects. And in this case, I really do not want to end up with two separate related lists. Would love to see further instructions on how to implement this!

Lakshmi Priya 17Lakshmi Priya 17
Hi,

I have also got a similar requirement. There are 3 case records, Case1, Case2 and Case3. All of them were created by the same user (same owner). If the user opens a case record, he should be able to see all the other case records that were created by him. That is from Case1 record, he should see Case2 and Case3 records. Similarly from Case2, Case1 & 3 must be visible and from Case3, Case1 & 2 must be visible.

Can someone help me here?

Thanks,
Lakshmi Priya.
RajnisfRajnisf
To answer this question -  We need to create one more custom object (Object A relationship) and create two fields 
Lets say "object A" and "Object A relationship" are two objects.
Create two fields on "Object A relationship" object
1. lookup to Object A
2. MD to Object A