Checking Constituents for a NetCommunity Login

I have been developing some updates for The Mergician. There are some nice additions coming soon including clean up of duplicate attributes and appeals following the merge. However one item that has been added is the request to select a record as the primary constituent if it has a NetCommunity Login associated with it.

I started looking at the Raiser’s Edge API to see if there were any fields or hidden data points. Nothing came out as being the obvious solution. I put the question to the API area on Blackbus to see if anybody had come across this before.  I was given a hint of where to look (thank you Warren). In the PIA (primary interop assembly) directory I was told to look at the REBBNCData assembly. What has made the whole process difficult for me is that I do not have access to any NetCommunity installation. I was sent a screenshot of the NetCommunity tab on the constituent record (thank you John). From these pieces of information I was able to work out what to do to check the existance of a login on the record.

For the following code you will need to add a reference to the above assembly.

 Public Shared Function DoesConstituentHaveBBNCLogin(ByVal constit As Blackbaud.PIA.RE7.BBREAPI.CRecord) As Boolean

        Dim client As Blackbaud.PIA.RE7.REBBNCData.CBBNCClientUser = Nothing

        Try
            client = New Blackbaud.PIA.RE7.REBBNCData.CBBNCClientUser
            client.Init(_SessionContext, constit)

            If client.Fields(Blackbaud.PIA.RE7.BBInterfaces.EBBNCClientUserFields.BBNCCLIENTUSER_fld_UserName) = "" Then
                Return False
            Else
                Return True
            End If

        Catch ex As Exception
            Return False

        Finally

            If client IsNot Nothing Then
                client.CloseDown()
                System.Runtime.InteropServices.Marshal.ReleaseComObject(client)
                System.Runtime.InteropServices.Marshal.FinalReleaseComObject(client)
                client = Nothing
            End If

        End Try

    End Function