Search code examples
c#intuit-partner-platformquickbooks-online

Update A Customer in QBO API 3


I have tried this however now I am getting a bad request.

var customers = IntuitServiceConfig.ServiceManager.FindAll<Customer>(new Customer(), 1, 100); 

foreach (Intuit.Ipp.Data.Customer customer in customers)
{
    Customer resultCustomer = IntuitServiceConfig.ServiceManager.FindById(customer) as Customer;

    //Mandatory Fields
    customer.Id = resultCustomer.Id;
    customer.SyncToken = resultCustomer.SyncToken;
    customer.GivenName = "Bob";
    customer.Title = "Mr.";
    customer.MiddleName = "Anto";
    customer.FamilyName = "Bob";

    Customer result = IntuitServiceConfig.ServiceManager.Update(customer) as Customer;
}

Solution

  • There is currently a bug in Dotnet SDK for Customer Update where the incorrect namespaces cause the request to error out. We are working on that. Check this workaround:

    Create a new Customer object and assign the result to it. Then call Customer update operation. Eg:

    Customer found = GetQboCustomer(); 
    Customer customerToUpdate = new Customer(); 
    customerToUpdate.Id = found.Id; 
    customerToUpdate.SyncToken = found.SyncToken; 
    //Set Other Properties 
    //Perform Sparse Update