Start a new topic

Crashing IOM

Hi guys,

I have been working with this code to add a solicitor to a gift during import but it is crashing IOM and I can't figure out why.  It works some of the time, especially where there is a solicitor to set, but it crashes usually at the end of the import.

Any ideas?

        ' Set the solicitor if there is one

        Dim oSols As New Blackbaud.PIA.RE7.BBREAPI.CAssignedSolicitors2

        ' Load the constituent solicitors

        oSols.Init(Import.SessionContext, oRec.Fields(Blackbaud.PIA.RE7.BBREAPI.ERECORDSFields.RECORDS_fld_ID), _


        ' If there are solicitors, pull out the Relationship Manager

        If oSols.Count > 0 Then

            ' Loop through solicitors to find the RM

            For Each oSol As Blackbaud.PIA.RE7.BBREAPI.CAssignedSolicitor2 In oSols

                If oSol.Fields(Blackbaud.PIA.RE7.BBREAPI.EASSIGNEDSOLICITOR2Fields.ASSIGNEDSOLICITOR2_fld_SOLICITOR_TYPE) = "Relationship Manager" Then

                    ' Found an RM so set the ID in the import

                    Import.Fields.GetByName("Solicitor").Value = oSol.Fields(Blackbaud.PIA.RE7.BBREAPI.EASSIGNEDSOLICITOR2Fields.ASSIGNEDSOLICITOR2_fld_SOLICITOR_ID)

                    Exit For

                End If


        End If

        ' Cleanup


        oSols = Nothing

I would do this for ~every~ oSol inside the For Loop (make sure you get the one before exiting the For too):

oSol = Nothing

Calling oSols.CloseDown() does not close down each oSol inside it (I've learned that lesson several times).

Another note, is that tvf_Sol2_UseFilterObject parameter required? If not, you might just forego supplying that argument, it does not look like you're using a filter object.
Jeff, you are the wind beneath my wings!
Login or Signup to post a comment