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
If you already have the IDs of the spouse and the child then you can create the relationship any time you want in the process so I would do it AfterSave or something.
You will need to create a New CIndividual2 record and populate it with the correct ids and then save it.
I would avoid the BeforeIndividualRelationshipSave function unless you are actually modifying the relationship that IOM is creating (which is not the case here).
Also note that BeforeIndividualRelationshipSave is potentially being called twice since you are making two different individual relationships through IOM (parent1/child and parent1/parent2 (spouse))
over 4 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)