Quickbooks API / XML自定义字段

时间:2014-09-15 16:48:40

标签: xml quickbooks

这是我在这里的第一篇文章。我正在使用Quickbooks for Windows传递数据以创建一个除了您在Quickbooks中创建的自定义字段之外的所有发票。我无法在XML中为自定义字段发送值。我收到这个错误。我希望在正确的方向上找到一点。

<?xml version="1.0"?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceAddRs requestID="143" statusCode="3180" statusSeverity="Error"     statusMessage="There was an error when saving a data extension named &quot;Shipper Name&quot;.  QuickBooks error message: The specified custom field cannot be used by the list or transaction element."/>
</QBXMLMsgsRs>
</QBXML>

这是XML:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <InvoiceAddRq>
            <InvoiceAdd>
                <CustomerRef>
                    <ListID>80000006-1410484985</ListID>
                </CustomerRef>
                <RefNumber>1642</RefNumber>
                <BillAddress>
                    <Addr1>Scott's Trucking</Addr1>
                    <Addr2>1004 Just sample data</Addr2>
                    <City>Isanti</City>
                    <State>MN</State>
                    <PostalCode>90210</PostalCode>
                    <Country>USA</Country>
                </BillAddress>
                <ShipAddress>
                    <Addr1>Mike's Trucking</Addr1>
                    <Addr2>123 dr</Addr2>
                    <City>Hayward</City>
                    <State>WI</State>
                    <PostalCode>54843</PostalCode>
                    <Country>USA</Country>
                </ShipAddress>
                <Memo>From Exspeedite Shipment #1642</Memo>
                <InvoiceLineAdd>
                    <DataExt>
                        <OwnerID>0</OwnerID>
                        <DataExtName>Shipper Name</DataExtName>
                        <DataExtValue>Bob</DataExtValue>
                    </DataExt>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <Desc>COMMODITIES</Desc>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <Desc>-----------</Desc>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <Desc>Freight of All Kinds (FAK) 3 pallets 3 items 1000 LBs </Desc>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Handling</FullName>
                    </ItemRef>
                    <Desc>Handling charges</Desc>
                    <Quantity>1</Quantity>
                    <Amount>60.00</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Freight</FullName>
                    </ItemRef>
                    <Desc>Freight charges</Desc>
                    <Quantity>1</Quantity>
                    <Amount>4600.00</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Mileage</FullName>
                    </ItemRef>
                    <Desc>Mileage</Desc>
                    <Quantity>2000</Quantity>
                    <Rate>2.30</Rate>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Fuel_Surcharge</FullName>
                    </ItemRef>
                    <Desc>Fuel surcharge</Desc>
                    <Quantity>1</Quantity>
                    <Amount>1120.00</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C104 -  - Reconsignment</Desc>
                    <Quantity>1</Quantity>
                    <Amount>60.09</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C104 -  - Reconsignment</Desc>
                    <Quantity>1</Quantity>
                    <Amount>60.09</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C118 - Inia Swan - Reconsignment</Desc>
                    <Quantity>1</Quantity>
                    <Amount>250.00</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C122 - XSTOP2 - Reconsignment</Desc>
                    <Quantity>1</Quantity>
                    <Amount>30.00</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C106 -  - Layover</Desc>
                    <Quantity>1</Quantity>
                    <Amount>91.02</Amount>
                </InvoiceLineAdd>
                <InvoiceLineAdd>
                    <ItemRef>
                        <FullName>Other</FullName>
                    </ItemRef>
                    <Desc>C107 -  - Layover</Desc>
                    <Quantity>1</Quantity>
                    <Amount>11.76</Amount>
                </InvoiceLineAdd>
        </InvoiceAdd>
        </InvoiceAddRq>
    </QBXMLMsgsRq>
</QBXML>

1 个答案:

答案 0 :(得分:2)

据你说:

  

我在整个发票级别寻找自定义字段,而不是在订单项级别

但是,您已在订单项级别传递

            **<InvoiceLineAdd>**
                <DataExt>
                    <OwnerID>0</OwnerID>
                    <DataExtName>Shipper Name</DataExtName>
                    <DataExtValue>Bob</DataExtValue>
                </DataExt>
            **</InvoiceLineAdd>**

(星号添加强调 - 请注意,您已将自定义字段放入订单项

如果您要在订单项之外的发票本身中查找自定义字段,那么您应该在订单项之外放置您的DataExt请求 - 例如做这样的事情:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="11.0"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError"><InvoiceAddRq>
  <InvoiceAdd defMacro="TxnID:Invoice19993557">
     ...
  </InvoiceAdd>
</InvoiceAddRq>
<DataExtAddRq requestID="86290">
  <DataExtAdd>
    <OwnerID>0</OwnerID>
    <DataExtName>Del. Phone #</DataExtName>
    <TxnDataExtType>Invoice</TxnDataExtType>
    <TxnID useMacro="TxnID:Invoice19993557"/>
    <DataExtValue>773-527-2199</DataExtValue>
  </DataExtAdd>
</DataExtAddRq>
</QBXMLMsgsRq>
</QBXML>

来源: