Start a new topic

Match Primary business details

I'm trying to get IOM to:

  1. Search through Organization Records
  2. Identify the Primary Business
  3. Compare to Import file based on Org Name & Position
  4. If these both match delete the data from the import file
  5. If these don't match continue on the add a New Org relationship

I'm getting stuck on simply opening the Org records - am pretty new to this so any help is greatly received

This is what I have so far - the values from the import file are pulling out correctly so I assume it's after this point is all falls down.

Public Overrides Sub AfterConstituentOpen(ByVal oRec As Blackbaud.PIA.RE7.BBREAPI.CRecord, ByVal Cancel As ImportOM.API.iCancel)

                MyBase.AfterConstituentOpen(oRec, Cancel)


                Dim oOrgs As Blackbaud.PIA.RE7.BBREAPI.COrganizations2

                Dim oOrg As Blackbaud.PIA.RE7.BBREAPI.COrganization2

                Dim strImpPosition, strREPosition, strImpOrgName, strREOrgName As String


'Declare organisations collection and values from import file

                strImpPosition = import.fields.GetByExcelName("AI").Value

                strImpOrgName = import.Fields.GetByExcelName("AL").Value 


'Loop through organisation collection to find primary record

                For Each oOrg In oOrgs

'Parse position and organisation name if organisation record is primary

                If oOrg.fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATION2FIELDS.ORGANIZATION2_fld_IS_PRIMARY) = True Then

                strREPosition = oOrg.fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATION2FIELDS.ORGANIZATION2_fld_POSITION)

                strREOrgName = oOrg.Fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATION2FIELDS.ORGANIZATION2_fld_NAME)

End If

Next oOrg


'If imported business detail is same as already on RE then clear out import file

                If strREOrgName = strImpOrgName Then

                If strREPosition = strImpPosition Then

'Delete import values

End If

End If   




End Sub


Try this way out to get the Primary Org record

Dim oPrimaryOrg As COrganization
oPrimaryOrg = CType(oRec, CIndividual).Organizations.PrimaryOrganization

The key here is that you can interact with a CRecord as a CIndividual if you retype it


but I think it should work :)

We are able to get the primary organization record (easily). However, getting to the rest of the org records is not as easy. Help. Please.
Go through 'relations' to get to ogranizations. 

Psuedo-code below:

For Each org As _COrganization In oRec.Relations.Organizations

      'Check if org is primary


      'Get org position


       'Get org name


Hope that helps.

Are you still having trouble with this?

It seems like all you want is the Primary Business information right? Why do you need to go through all of the Org relationships?

Because Cheryl H. hijacked the thread and asked about getting "to the rest of the org records".

I still wanted to help.

Login or Signup to post a comment