I always thought that CConstitAddress and IBBConstitAddress and CConstitAddressPhone and IBBPhone were more or less interchangeable. Or at least from the perspective of the constituent. If I have just jumped over too many steps in one sentence then let me start again.
There are two routes you can go down to get address and phone information. The first, using CConstitAddress and CConstitAddressPhone objects applies only to constituent. The second, using IBBConstitAddress and IBBPhone apply in general to non-constituent objects such as CIndividual2, COrganization2, CParticipant and CFinancial2 objects.
Now what is not so obvious is that in general it appeared that you could use the “IBB” model to also retrieve the constituent’s address and phone details. This implied that CConstitAddress implemented the IBBConstitAddress interface and CConstitAddressPhone implemented the IBBPhone interface. This seemed to work for most fields until I tried the following code:
Dim oAddress As IBBConstitAddress Dim oPhone As IBBPhone For Each oAddress In oConstituent.Addresses For Each oPhone In oAddress.Phones If oPhone.Fields(CONSTIT_ADDRESS_PHONES_fld_DO_NOT_CALL) = True Then 'Do something here End If Next oPhone Next oAddress
However for constituents the do not call field contains neither a true nor a false (a -1 or a 0 value) but rather is “Empty” for both scenarios. When I change the code to the following:
Dim oAddress As CConstitAddress Dim oPhone As CConstitAddressPhone For Each oAddress In oConstituent.Addresses For Each oPhone In oAddress.Phones If oPhone.Fields(CONSTIT_ADDRESS_PHONES_fld_DO_NOT_CALL) = True Then oPhone.Fields(CONSTIT_ADDRESS_PHONES_fld_DO_NOT_CALL) = False bWarning = True End If Next oPhone Next oAddress
I get the expected results.
When I first started writing this article I thought that Blackbaud had decided to split these two methods irrevocably and indeed the above example does appear to be the start of that. That is of course until you try the “IBB” code on a non-constituent top level object. I tried it on an individual and it gives the same empty result. I fear that this is just a bug. Blackbaud tech support any thoughts?
As an aside The CFinancial2 object breaks the mould with top level objects that have phones. It appears to be one of the few that do not have an address collection with phones tied to each address. In fact it does not have any addresses at all. It only has a collection of phones. The CFinancial2 object is a specific constituent’s bank. That bank has an address but clearly the powers that be decided that a specific constituent’s bank could have their own phone numbers but not their own addresses. The mind boggles.