Here's my code in case someone else is trying to do something similar:
Public Overrides Sub BeforeRowCommit(ByVal Cancel As ImportOM.API.iCancel) MyBase.BeforeRowCommit(Cancel)
'Now let's add a Parent/Child relationship to the spouse record (parent2) if they are a full constituent
Dim oChild As New CRecord 'new crecord for child Dim oParent2 As New CRecord ' new crecord for parent2 Dim oChildID As Integer = 0 Dim oParent2ID As Integer = 0 Dim oInd As New CIndividual2 'new individual relationship record
CIndividual2 is what you want to be using. CIndividual is an older interface that I believe it only used in internal collections now.
about 2 years ago
I'm not even sure what I want to do is possible. We have a file with the Child's ID, Parent1 info and Parent2 info (may have parent2 - may not). Parent1 ID is the primary ID. We make a relationship between Parent1 and the child. We also add the spouse if needed. What we are now trying to do is add a relationship between the spouse and the child if the spouse happens to be a full constituent already. Currently, we do this in two separate imports and manipulate the mappings - making Parent2 the primary ID and creating a relationship if Parent2 is a full constit.
When I use the BeforeConstituentRelationshipSave sub i get the child relationship but when I try to add the relationship to parent2 i get the following error: Cannot create an individual relationship using an organization.
Here's the code I'm using: Public Overrides Sub BeforeIndividualRelationshipSave(ByVal oInd As CIndividual2, ByVal oIndRecord As CRecord, ByVal GroupNumber As Integer, ByVal Cancel As ImportOM.API.iCancel) MyBase.BeforeIndividualRelationshipSave(oInd, oIndRecord, GroupNumber, Cancel)