Hello I am facing issue when adding SalesOrderAddRq in Quickbooks using https://packagist.org/packages/consolibyte/quickbooks
following is my XML for adding salesorder in Quickbooks and also here is tag <ListID >
what will be the value of this is field!
further more i am getting this error when adding
Version: PHP QuickBooks SOAP Server v3.0 at /quickbooks/qbwc
Message:
3140: There is an invalid reference to QuickBooks Customer "john Doe" in the SalesOrder. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
Description:
Error message received from application via getLastError(): 3140: There is an invalid reference to QuickBooks Customer "john Doe" in the SalesOrder. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
public function _addSaleorderRequest($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $version, $locale)
{
// Do something here to load data using your model
//$data = $this->yourmodel->getCustomerData($ID);
// Build the qbXML request from $data
$xml = '<?xml version="1.0"?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<SalesOrderAddRq requestID="' . $requestID . '">
<SalesOrderAdd>
<CustomerRef> <!-- required -->
<ListID >' . $requestID . '</ListID> <!-- optional -->
<FullName >john Doe</FullName> <!-- optional -->
</CustomerRef>
<TxnDate>2013-05-23</TxnDate>
<RefNumber>$requestID</RefNumber>
<BillAddress>
<Addr1>China Town One</Addr1>
<Addr2>China Town Two</Addr2>
<City>Pta Nai</City>
<State>Dont Know</State>
<PostalCode>420420</PostalCode>
<Country>PK</Country>
</BillAddress>
<ShipAddress>
<Addr1>China Town One</Addr1>
<Addr2>China Town Two</Addr2>
<City>Houston</City>
<State>TX</State>
<PostalCode>77074</PostalCode>
<Country>US</Country>
</ShipAddress>
<SalesOrderLineAdd>
<ItemRef>
<FullName>Booklets:CB1-101</FullName>
</ItemRef>
<Desc>CHF</Desc>
<Quantity>15</Quantity>
<Amount>59.25</Amount>
</SalesOrderLineAdd>
<SalesOrderLineAdd>
<ItemRef>
<FullName>Booklets:CB3-101</FullName>
</ItemRef>
<Desc>High Blood Pressure</Desc>
<Quantity>15</Quantity>
<Amount>59.25</Amount>
</SalesOrderLineAdd>
<SalesOrderLineAdd>
<ItemRef>
<FullName>Booklets:DB1-101</FullName>
</ItemRef>
<Desc>Diabetes Type 1 or 2 with Insulin</Desc>
<Quantity>15</Quantity>
<Amount>59.25</Amount>
</SalesOrderLineAdd>
<SalesOrderLineAdd>
<ItemRef>
<FullName>Booklets:DB2-101</FullName>
</ItemRef>
<Desc>Diabetes Type 1 or 2 w/o Insulin</Desc>
<Quantity>15</Quantity>
<Amount>59.25</Amount>
</SalesOrderLineAdd>
</SalesOrderAdd>
</SalesOrderAddRq>
</QBXMLMsgsRq>
</QBXML>';
return $xml;
}
This message:
3140: There is an invalid reference to QuickBooks Customer "john Doe" in the SalesOrder. QuickBooks error message: Invalid argument. The specified record does not exist in the list.
Means that you're telling QuickBooks to add a Sales Order for customer John Doe
, but that customer does not exist in QuickBooks.
You can't add a Sales Order to a customer that does not exist.
This is akin to how every single relational database system works -- you have foreign keys/dependencies between records that you need to satisfy.
This:
<ListID >' . $requestID . '</ListID>
Is not a a valid ListID
value. You need to pass in a valid ListID
value.
You're passing in the $requestID
value for the specific qbXML request, which is completely unrelated in every way to a ListID
for a customer.
Please pass a valid Customer ListID
value (or alternatively, pass in a valid Customer Name
value and don't pass the ListID
tag at all).