Start a new topic

Cancel not working in new IOM

We juts upgraded to the new IOM and it broke my sweet sweet REImport Bridge profile (that uses IOM to run an RE Import).


The line that is failing seems to be 

Cancel.CancelImport("Import " & Import.ImportFileName & " SUCCESS")

 

with this error:

Error in custom code BeforeImport: Nothing:

Init method must be called before using this object Line:0

 

Full Code Below: (it gets to 6 but not 7 in my fancy debugging statements) 


Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports ImportOM.API
 
'This code is specific to your current profile
 
Public Class Profile
    Inherits ImportOM.API.ProfileBase
 
#Region "Events"
    Public Overrides Sub BeforeImport(Cancel As iCancel)
        Dim importid As Double = CDbl(Split(Import.ImportFileName, ".")(0))
        Dim reimport As Object = CreateObject("BBImport7.CImport")
        MsgBox("1")
        Try
            With reimport
            MsgBox("2")
                .Init(Import.SessionContext)
                .Load(importid)
                MsgBox("3")
                If Not .ExecuteImport() Then
                MsgBox("FAILED")
                    Cancel.CancelImport("Import " & Import.ImportFileName & " FAILED")
                End If
            End With
        Finally
        MsgBox("4")
            If reimport IsNot Nothing Then
                reimport.CloseDown()
            End If
            reimport = Nothing
            MsgBox("5")
        End Try
        MsgBox("6")
        Cancel.CancelImport("Import " & Import.ImportFileName & " SUCCESS")
        MsgBox("7")
    End Sub
 
#End Region
 
End Class

 

1 Comment

I figured out the problem and it was not the API but a file permission thing.  Sorry Nic.

Login or Signup to post a comment