google-code-export / npsp

Automatically exported from code.google.com/p/npsp
1 stars 0 forks source link

Reciprocal relationship is not created #357

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If you create 2 relationships via 2 insert statements as part of the same 
transaction, the 2nd relationship never gets a reciprocal. We can't combine the 
relationships into one list for insert because one of the relationships is 
getting created via a trigger, and the other one is created via code in the 
controller for the VF page. 

Steps to reproduce:

// Create three contacts
Contact mainClient = new Contact(FirstName='Main',LastName='AAAClient');
insert mainClient;
Contact friend = new Contact(FirstName='Test',LastName='AAAFriend');
insert friend;
Contact coworker = new Contact(FirstName='Test',LastName='AAACoworker');
insert coworker;

// Create two relationships
npe4__Relationship__c r = new 
npe4__Relationship__c(npe4__Contact__c=mainClient.Id,npe4__RelatedContact__c=fri
end.Id,npe4__Type__c='Friend');
insert r;
r = new 
npe4__Relationship__c(npe4__Contact__c=mainClient.Id,npe4__RelatedContact__c=cow
orker.Id,npe4__Type__c='Coworker');
insert r;

The 2nd relationship created (no matter what it is) never gets a reciprocal.

Problem is happening in version 2.0.1 of the relationships package.

Original issue reported on code.google.com by sandy.ba...@exponentpartners.com on 7 Aug 2013 at 4:03

GoogleCodeExporter commented 9 years ago
Was able to reproduce, I posted the issue here:  
https://github.com/SalesforceFoundation/Relationships/issues/15

Will investigate for the next Relationships release

Original comment by kbro...@gmail.com on 7 Aug 2013 at 4:44