Creating a Custom Import Engine

Background

If the standard QBO 3 Import Engines are insufficient for your use case, you can create a custom engine and plug it into the QBO 3 architecture.

Steps include:
  • Create a class (.NET managed code) that implements the QBO 3 IImportEngine interface. Consider deriving from qbo.Import.Engines.AbstractEngine.
  • Modify the ImportEngine.config file to include a reference to your new class
  • Create an Import File Template that uses your new class (selected from the Plugin dropdown list)

Import Pipeline

Importing data into QBO 3 via the Import module typically involves the following steps:
  1. Creating an ImportFile record
  2. Uploading some Attachment to a QBO 3 file store (stored in ImportFile.PreTransformID)
  3. Calling ImportFile/Import: this will invoke the configured Import Engine
  4. Calling ImportFile/EndImport: this lets calling workflows know that the Import has been completed
The QBO 3 Import Dashboard (ImportFile.ashx/Home) provides a panel that allows you to accomplish steps 1 and 2 simply by dragging a file onto it. You may also start the pipeline by calling ImportFile/Watch, and have QBO 3 monitor any file repository (FTP site, UNC file location, etc.) for files to import.

IImportEngine Interface

The IImportEngine interface defines the following methods:
  • Preview (optional): performs a read-only display of the data to be imported
  • Import (required): imports the data from the ImportFile.PreTransformID
  • Validate (optional): invokes some validation statement to ensure the data is valid prior to import
  • PreTransform (optional): a method to transform ('massage') the data prior to importing it
  • PostTransform (optional): a method to transform the results at the end of the transform (typically to return data back to a third party in their format)
The AbstractEngine implements all the methods above except the critical Import method.

Examples

Examples of these plugins include:
  • BatchEngine: allows Excel files to 'script' any QBO 3 operations
  • SqlEngine: have SQL Server do all the work using TSQL
    • note that the Attachment uploaded (ImportFile.PreTransformID) will, by default, be located on the database server drives until the import is done
    • you can use OPENROWSET or SSIS packages in this manner
  • XmlEngine: processes QBO3 compliant XML against the Import framework


Comments