The Import Framework is a series of methods in each QBO class that allows for the importing of data via XML.
Use case: insert a message
<ImportCollection Reference="abc">
<MessageItem>
<Message>This is the subject</Message>
<BodyText>Message Content Goes here</BodyText>
</MessageItem>
</ImportCollection>
Use case: insert a loan if it does not exist, update it if it already exists (upsert)
<LoanItem>
<Loan>1234567890</Loan>
<UPBAmount>277,522.33</UPBAmount>
<SubscriberID>www.mybank.com-PortfolioA-Loans-1234567890</SubscriberID>
</LoanItem>
Notes:
The SubscriberID must be a globally unique string
QBO will check the ObjectSubscription table; if the SubscriberID is found, we update the existing record, else we insert the record (and a new ObjectSubscription row)
Use case: upsert a loan, and property information
<LoanItem>
<Loan>1234567890</Loan>
<UPBAmount>277,522.33</UPBAmount>
<SubscriberID>www.mybank.com-PortfolioA-Loans-1234567890</SubscriberID>
<Property>
<Address>123 Main Street</Address>
<City>Anywhere</City>
<State>CA</State>
<PostalCode>92101</PostalCode>
</Property>
</LoanItem>
Notes:
The Loan table has a foreign key column called 'PropertyID', bound to the Property table
The existence of a Property node under the LoanItem node matches the PropertyID (minus the 'ID'), so QBO recognizes it as a property
If we are updating the loan and Loan.PropertyID is not NULL, we will update the matching Property record
If we are updating the loan and Loan.PropertyID is NULL, we will insert a Property record, and set Loan.PropertyID to the new record
If we are inserting the loan, we will insert a Property record, and set Loan.PropertyID to the new record
Use case: upset a loan, and borrower information
<LoanItem>
<Loan>1234567890</Loan>
<UPBAmount>277,522.33</UPBAmount>
<SubscriberID>www.mybank.com-PortfolioA-Loans-1234567890</SubscriberID>
<Borrowers>
<BorrowerItem>
<LastName>Doe</LastName>
<FirstName>Jane</FirstName>
<Sequence>1</Sequence>
</BorrowerItem>
<BorrowerItem>
<LastName>Doe</LastName>
<FirstName>John</FirstName>
<Sequence>2</Sequence>
</BorrowerItem>
</Borrowers>
</LoanItem>
Notes:
The LoanObject C# class contains a property called Borrowers
The BorrowerObject C# class contains a property called LoanID, marked with a Parent property
The import framework recognizes the Borrowers node as matching the Borrowers property, and for each borrowers inserted, marks it's parent property with the Loan.LoanID
The BorrowerItem/Sequence uniquely identified the borrower within a Loan; one could use a BorrowerItem/SubscriberID instead
Use case: uploading documents
<AttachmentItem>
<FileName>TestFile2.txt</FileName>
<Template>Deficiency Judgement</Template>
<Description>Description goes here</Description>
<Content><![CDATA[VGVzdCBEYXRhIEdvZXMgSGVyZQ==]]></Content>
</AttachmentItem>
Notes:
The AttachmentObject C# class will assume a Content node is base 64 encoded content
You can use a SubscriberID here
Use case: generating a mail merged document
<AttachmentItem>
<Template>Deficiency Judgement</Template>
<Object>Loan</Object>
<ObjectSubscriberID>www.mybank.com-PortfolioA-Loans-1234567890</ObjectSubscriberID>
</AttachmentItem>
Notes:
The minimum data required to generate a document are Object, ObjectID/ObjectSubscriberID, and Template; additional columns may be specified if you wish
The ObjectSubscriberID used here matches the SubscriberID used in the Loan example above
Any foreign key column may be aliased with a SubscriberID (e.g. LoanItem/PropertySubscriberID would set Loan.PropertyID to the PropertyID matching PropertySubscriberID)