android.fryo
android.fryo

Reputation: 1489

Update Customer - Intuit Anywhere

We are trying to add write back feature in our application. We are using Java SDK. We trying two ways to update an existing customer

Method 1

  1. Retrieve the customer object using customerQuery
  2. Use th same customer object to update
  3. Successfully updated.

Method 2

  1. Create new customer object
  2. set Id using SetId() method for the newly created object
  3. update customer
  4. Getting following exception

-2001Error Detail :: cvc-complex-type.2.4.a: Invalid content was found starting with element 'MiddleName'. One of '{"http://www.intuit.com/sb/cdm/v2":SyncToken, "http://www.intuit.com/sb/cdm/v2":MetaData, "http://www.intuit.com/sb/cdm/v2":ExternalKey, "http://www.intuit.com/sb/cdm/v2":Synchronized, "http://www.intuit.com/sb/cdm/v2":AlternateId, "http://www.intuit.com/sb/cdm/v2":CustomField, "http://www.intuit.com/sb/cdm/v2":Draft, "http://www.intuit.com/sb/cdm/v2":ObjectState, "http://www.intuit.com/sb/cdm/v2":PartyReferenceId, "http://www.intuit.com/sb/cdm/v2":TypeOf}' is expected. com.intuit.ds.qb.IDSException: Error (-2001): cvc-complex-type.2.4.a: Invalid content was found starting with element 'MiddleName'. One of '{"http://www.intuit.com/sb/cdm/v2":SyncToken, "http://www.intuit.com/sb/cdm/v2":MetaData, "http://www.intuit.com/sb/cdm/v2":ExternalKey, "http://www.intuit.com/sb/cdm/v2":Synchronized, "http://www.intuit.com/sb/cdm/v2":AlternateId, "http://www.intuit.com/sb/cdm/v2":CustomField, "http://www.intuit.com/sb/cdm/v2":Draft, "http://www.intuit.com/sb/cdm/v2":ObjectState, "http://www.intuit.com/sb/cdm/v2":PartyReferenceId, "http://www.intuit.com/sb/cdm/v2":TypeOf}' is expected.

Method 1 is working perfectly. But have i susses with method 2. Is the first method is correct ? What is the problem with second method ?

Upvotes: 1

Views: 413

Answers (1)

Keith Palmer Jr.
Keith Palmer Jr.

Reputation: 27952

Method 2

Create new customer object set Id using SetId() method for the newly created object update customer Getting following exception

This ^^^ won't work because you aren't providing the SyncToken value then.

Look at the docs and look at the update a QuickBooks customer examples, paying special attention to that SyncToken tag that always shows up.

The latest SyncToken tag must ALWAYS be provided whenever you do an update/mod operation with QuickBooks. That means that to update a customer you must always do a query first to grab the latest SyncToken value, set the SyncToken in your mod/update request, and then send the request.

More information about SyncTokens on our QuickBooks integration wiki.

Upvotes: 3

Related Questions