What is a SyncToken

From ConsoliBYTE Wiki
Jump to: navigation, search
You'll often see a
SyncToken
tag in Intuit's IDS XML requests:
 
<?xml version="1.0" encoding="UTF-16"?>
<Mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  RequestId="7699faaff20f4e16987e26bddbbf9461"
  xmlns="http://www.intuit.com/sb/cdm/v2">
   <Object xsi:type="Customer">
   <Id>43497400</Id>
 
   <!-- what the heck is this? -->
   <SyncToken>1</SyncToken>
 
   <MetaData>
 

The SyncToken is an incrementing value that changes *every time a record changes, regardless of if the record changes in QuickBooks itself, or as the result of some external integrated application changing it*.

Whenever you do a mod/update operation, you MUST provide the latest SyncToken value. Thus, to do a mod/update operation, you'll have to query for the record first, set the SyncToken in your mod/update request, and then send your request.

It's meant by Intuit to be a way to avoid two people working on the same record at the same time, and unknowingly overwriting each other's changes.

This is the equivalent to the EditSequence value in the QuickBooks SDK.