Plug-ins > FM Books Connector Online

Only Id's work as QB element references?


With qbxml one could refer to QB elements by using the <FullName> tag.  For instance, when pushing an invoice to QB I could refer to an item on that invoice by using the QB item name.  Now the new SDK's ESR description of the Reference Type says that name is "Optional in requests", and the the Id "...can be used is subsequent entity requests to retrieve the entire instance".  But seems that the only way to get past QB validation is to use the Item's Id.  Is this expected behavior?

If so, is this a change in the QB SDK?  If so, this seems like another flaw in the ESR to not clearly point this out. 

BTW: the need to use Id's seems to be holding true for references to all QB elements, not just Items.  If this is true, it means a significant change in the SDK over previous versions.

Chris Turner:
Hi pjreagan,

The SDK for QuickBooks Online and the SDK for QuickBooks Desktop are two entirely different formats, one using qbXML (desktop), and the other using the Intuit V3 QBO format (online) Though they have common sources (QBO V2 is similar to how the qbXML is structured), they are vastly different in structure. The core difference in this case is the difference between the qbXML "ListID" and "FullName" elements, and the V3 SDK's "ReferenceType" data type.

You can define either ListID or FullName in a qbXML request, which would create a corresponding <ListID> or <FullName> element. In the ESR, that style of handling for the ReferenceType element (say, "Id" field) does not match; if you define a ReferenceType subfield ("Value" or "name"), it will map to a corresponding part of the same element. The ReferenceType format is as follows: "<fieldName name='some name value'>Value</fieldName>"

For example, if we define a customer's QuickBooks ID as "12345" and their full name as "John Smith", here is how it would appear in the XML for both qbXML and QBO V3:

--- Code: -------qbXML----
PCQB_RqAddFieldWithValue( "ListID" ; "12345" ) => <ListID>12345</ListID>
PCQB_RqAddFieldWithValue( "FullName" ; "John Smith" ) => <FullName>John Smith</FullName>

----QBO V3----
PCQO_RqAddFieldWithValue( "Id::name" ; "John Smith" ) & PCQO_RqAddFieldWithValue( "Id::Value" ; "12345" ) => <Id name='John Smith'>12345</Id>

--- End code ---

The issue you have noticed is that if the actual Id's value (defined as the ReferenceType's "Value" field) is not specified, it would essentially create an empty tag ("<Id name='John Smith'/>"), which would not be valid according to QBO V3's validation schema. It may still have the full name, but it still needs the "Value" field defined. This is expected behavior according to the ESR.

If you need to query for an entity by its name or full name, but do not know it's QBO Id, you can use the "QueryString" field to specify a SQL select statement to get the information you need.

--- Code: ---Example: Querying for all items named "Amaretto"

PCQO_RqNew( "Query" ; "Item" )
PCQO_RqAddFieldWithValue( "QueryString" ; "SELECT * FROM Item WHERE Name = 'Amaretto'" )

--- End code ---

The above example would be similar to specifying the FullName element as "Amaretto" in an ItemQuery request with qbXML.

Thanks Chris for so clearly explaining the situation - and validating what I had discovered.  I only wish the ESR had explained it as well as this.  At least now the explanation is here in the forum for others to find.

Intuit's change to  the V3 format forced me to update a FileMaker system that was already proven to interact properly with QB (online and desktop) using qbxml.  It has been frustrating to find that so many important details have been changed without proper documentation. 


[0] Message Index

Go to full version