Search code examples
quickbooksqbxml

How to add Account Reference in QuickBooks while adding bills from c# application


I am using Quickbooks Desktop 18.0 and I am syncing data between my c# application and QuickBooks via Web Connector.

I have one task where I have to push bills and I have predefined account reference for each expenses row in Bill under Vendors -> Bills.

I am unable to push the Bills because, I am getting error like this

0x80040400: QuickBooks found an error when parsing the provided XML text stream

The error caused due to middot separator in Account reference. Account reference name is

EXPENDITURE:Marketing:858700 · Advertising

Look between 858700 and Advertising. If I remove the <AccountRef> tag from the BillAddRq XML, Bill is pushed and If I replace the middot with dash then I get error like this

<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<BillAddRs statusCode="3140" statusSeverity="Error" statusMessage="There is an invalid reference to QuickBooks Account &quot;EXPENDITURE:Marketing:858700 - Advertising&quot; in the Bill.  QuickBooks error message: Invalid argument.  The specified record does not exist in the list." />
</QBXMLMsgsRs>
</QBXML>

I need to push Bill along with Account reference.

What should I do?

Please help. Thanks in advance.


Solution

  • A couple of things here --

    1. You can't just change an account name randomly, and expect it to work. So don't just swap out random characters (e.g. the bullet point) for a -dash- and expect it to work.

    2. Whoever gave you that account name gave you the wrong data. The account name is actually: EXPENDITURE:Marketing:Advertising. They copy/pasted something off of a report in QuickBooks and gave you the Account Number and the Account Name fields smushed together (by that bullet dot). The actual account name alone does not include the bullet dot.

    3. In the future, if you do an AccountQuery against QuickBooks, you can look at the FullName that you get back and see the actual account names you should be using, vs. relying on the data someone is sending you/you're seeing in the UI that's formatted with the account number plus the account name together.