Question

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;
}
Was it helpful?

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

OTHER TIPS

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
    resultCustomer.GivenName = "Bob";
    resultCustomer.Title = "Mr.";
    resultCustomer.MiddleName = "Anto";
    resultCustomer.FamilyName = "Bob";

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

You were about to get some customers list and again finding by id then updating the old, that wont be fine, u can do like above or the best way i believe is below.

var customers = IntuitServiceConfig.ServiceManager.FindAll<Customer>(new Customer(), 1, 100); 
foreach (Intuit.Ipp.Data.Customer customer in customers)
{
    //Mandatory Fields
    customer.GivenName = "Bob";
    customer.Title = "Mr.";
    customer.MiddleName = "Anto";
    customer.FamilyName = "Bob";

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

You can try to capture the raw request and response XMLs related to this update API call. Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0150_ipp_.net_devkit_3.0/logging#Request_and_Response_Log

You can also try to create the customer update payload and try the update call using Apiexplorer. https://developer.intuit.com/apiexplorer?apiname=V3QBO#Customer

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top