quickbooksintuit-partner-platformqbxml

Editing multiple times of SO gives error QBWC ERROR: 3200 - The provided edit sequence "" is out-of-date


I am trying to edit a SalesOrder from QB Desktop. Passing a QBXML structure for it.

    <?xml version="1.0" encoding="ISO-8859-1"?>
<?qbxml version="13.0"?>
<QBXML>
  <QBXMLMsgsRq onError="stopOnError">
    <SalesOrderModRq>
      <SalesOrderMod>
        <TxnID>AE5-xxxxx</TxnID>
        <EditSequence>xxxxxxx</EditSequence>
        <CustomerRef>
          <FullName>R.M.H:Winterstone:Test DRIVE</FullName>
        </CustomerRef>
        <TxnDate>2023-02-20</TxnDate>
        <BillAddress>
          <Addr1>123</Addr1>
          <Addr2></Addr2>
          <City>TAMPA</City>
          <State>Florida</State>
          <PostalCode>33618</PostalCode>
          <Country>United States</Country>
        </BillAddress>
        <PONumber>204392</PONumber>
        <Other>Summerstone</Other>
        <SalesOrderLineMod>
          <TxnLineID>AE7-xxxx</TxnLineID>
          <ItemRef>
            <FullName>Single Family</FullName>
          </ItemRef>
          <Desc>Test Line 1 </Desc>
          <Quantity>1</Quantity>
          <Amount>85.00</Amount>
        </SalesOrderLineMod>
      </SalesOrderMod>
    </SalesOrderModRq>
  </QBXMLMsgsRq>
</QBXML>

But it gives me this error after an edit

QBWC ERROR: 3200 - The provided edit sequence "xxxxxx" is out-of-date.

I saw a similar question like this in stack overflow from below link. The provided edit sequence "" is out-of-date

But it didn't help me to find a solution.No idea how to sent SyncToken in XML request and what value I have to pass for it?. Because from QB Desktop I didn't see any field called SyncToken from SalesOrder Response.

This is the XML Response structure that I got from QB Desktop when i queried the existing Sales Order that I am trying to modify

     {"xml_attributes"=>{"requestID"=>"1", "statusCode"=>"0", "statusSeverity"=>"Info", "statusMessage"=>"Status OK"},
 "sales_order_ret"=>
  [{"xml_attributes"=>{},
    "txn_id"=>"6F-xxxxx",
    "time_created"=>"2022-06-28T18:33:04-05:00",
    "time_modified"=>"2022-06-28T18:37:19-05:00",
    "edit_sequence"=>"xxxxx",
    "txn_number"=>13,
    "customer_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000004-xxxx", "full_name"=>"R.M.H:Winterstone:Test DRIVE"},
    "template_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000008-xxxx", "full_name"=>"Custom Sales Order"},
    "txn_date"=>"2022-06-28",
    "ref_number"=>"11",
    "bill_address"=>{"xml_attributes"=>{}, "addr1"=>"123", "city"=>"zz", "state"=>"FL", "postal_code"=>"33z618", "country"=>"zzz"},
    "bill_address_block"=>{"xml_attributes"=>{}, "addr1"=>"123", "addr2"=>"sds, sdsd sdsd", "addr3"=>"Unsditsded Statsdes"},
    "po_number"=>"204391",
    "due_date"=>"xxxx",
    "ship_date"=>"xxxx",
    "subtotal"=>85.0,
    "sales_tax_percentage"=>0.0,
    "sales_tax_total"=>0.0,
    "total_amount"=>85.0,
    "is_manually_closed"=>false,
    "is_fully_invoiced"=>true,
    "is_to_be_printed"=>true,
    "is_to_be_emailed"=>false,
    "other"=>"xxxxx",
    "sales_order_line_ret"=>
     {"xml_attributes"=>{},
      "txn_line_id"=>"xxxxxxx",
      "item_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000004-1650461887", "full_name"=>"Single Family"},
      "desc"=>"Test Line 1",
      "quantity"=>#<BigDecimal:7fb52e8c48b8,'0.1E1',9(18)>,
      "rate"=>85.0,
      "amount"=>85.0,
      "sales_tax_code_ref"=>{"xml_attributes"=>{}, "list_id"=>"80000002-xxxxx", "full_name"=>"Non"},
      "invoiced"=>#<BigDecimal:7fb533636088,'0.1E1',9(18)>,
      "is_manually_closed"=>false}},]

Can anyone help me on this?


Solution

  • This generally indicates that someone updated your object in the QuickBooks GUI, or from another integrated application, immediately before your application tried to update it.

    Every single time something edits an object in QuickBooks, the EditSequence value is updated.

    If you try to edit something and send an old, out-of-date EditSequence value, you get this error.

    To fix this, you should query for the object, get the latest EditSequence value, and re-submit the update request with the latest value.