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
Dan Dodd 3Dan Dodd 3 

How to "pair up" existing record to another record on same sObject?

I have a custom object for trip registrations. 
I need to pair up the records to make roommates.
So a husband and wife sign up for the trip and e get two registrations records.  Sallie and Sam

Now I want to pair them up as room mates.

I could make a text fields roommate and enter Sam for Sallie's romie  and Sallie for Sam's roomie.

The problem with that method is that it could lead to typos .
Can I make a field that would lookup names in the registration finding only those not yet paired.
I have 50 registrations so the first lookup would have 49  names, everyone else but the first name selected to pair.
Once paired and on to the next, there would be 47 to pick from and so on going down by 2 every time a pairing was made.

How can I make this pairing and use the names in reports?

I wuld like to do this in LWC or even in the standard details of the customer object.
VinayVinay (Salesforce Developers) 
Hi Dan,

Hope below links will help you on your implementation.

https://developer.salesforce.com/forums/?id=906F0000000MLu3IAG 
https://success.salesforce.com/answers?id=9063A000000DmwsQAC 
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_merge.htm
https://salesforce.stackexchange.com/questions/251324/merge-method-in-apex 

Thanks,
Vinay Kumar
Dan Dodd 3Dan Dodd 3
Thanks for taking a look,
This will be helpful someday when I need to MERGE two records.

But right now I am trying to PAIR two records, make them inter-related but still TWO DISTINCT RECORDS.

Does that make sense?