Start a new topic

Field Dump for object

I built this little utility function that I find very helpful for debugging.

You pass it an object and the enumeration type for the fields and it will return a string of all of the fields of that object and whether they are "dirty" or not (denoted by a *** on the line).

Add this to your Global.vb:

Public Shared Function FieldDump(of T)(oObj As Blackbaud.PIA.RE7.BBREAPI.IBBDataObject) As String


       Dim sOutput As String

       sOutput = oObj.GetType().ToString() & " : " & iif(oObj.Dirty = True, "DIRTY","clean") & VbCrLf & vbCrLf

    For Each iEnumVal As Integer In System.Enum.GetValues(GetType(T))

        sOutput &= iif(oObj.FieldIsDirty(iEnumVal) = True,"***","")

        sOutput &= System.Enum.GetName(GetType(T), iEnumVal) & " -> "

        sOutput &= oObj.Fields(iEnumVal) & vbCrLf



    Return sOutput

End Function


To call it from your code:


Public Overrides Sub BeforeConstituentSave(ByVal oRec As Blackbaud.PIA.RE7.BBREAPI.CRecord, _

                                    Cancel as ImportOM.API.iCancel)

    'The main constituent record is about to be saved

    ' Track new constituents

    MsgBox(GlobalCode.FieldDump(Of Blackbaud.PIA.RE7.BBREAPI.ERECORDSFields)(oRec))

End Sub


Output looks like (changed First Name in this example):


Login or Signup to post a comment