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 

                oOrgs.Init(Import.SessionContext,(Blackbaud.PIA.RE7.BBREAPI.ERECORDSFields.RECORDS_fld_ID))

'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   

                oOrg.CloseDown

                oOrgs.CloseDown

 

End Sub


Hello!

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

DISCLAIMER: I DID NOT ACTUALLY TRY THIS

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
       org.Fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATIONFIELDS.ORGANIZATION_fld_IS_PRIMARY) 

 

      'Get org position

      org.Fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATIONFIELDS.ORGANIZATION_fld_POSITION)

       'Get org name
      org.Fields(Blackbaud.PIA.RE7.BBREAPI.EORGANIZATIONFIELDS.ORGANIZATION_fld_NAME)

Next 


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