12

When I want to update the balance in a Invoice, the code below is running normally without any error, but the balance doesn't change, why?

var queryService = new QueryService<Intuit.Ipp.Data.Invoice>(context);
    IList<Intuit.Ipp.Data.Invoice> list = queryService.Where(p => true).ToList();
    foreach (var invoice in list)
    {                  
        if (invoice.Id == order.Accounting.QBOID)
        {       
            if (invoice.Balance != order.Accounting.SurveyAmount)
            {
                Invoice invo = new Invoice();
                invo.Id = invoice.Id;
                invo = commonService.FindById(invo);
                invo.Balance = order.Accounting.SurveyAmount.HasValue ? order.Accounting.SurveyAmount.Value : 0; 
                invo.sparse = true;
                commonService.Update(invo);
            }
        }
Adi Inbar
  • 12,097
  • 13
  • 56
  • 69
Tangfb
  • 183
  • 8

1 Answers1

4

Balance is a read-only field in Invoice. It can't be updated.

Ref doc.

Add

enter image description here Thanks

itzmebibin
  • 9,199
  • 8
  • 48
  • 62
Manas Mukherjee
  • 5,270
  • 3
  • 18
  • 30
  • 1
    So how can i sync price or change something like balance etc.? I want to achieve the sync function between local program and QuickBooks and update the balance if they are different. – Tangfb Sep 16 '13 at 10:40
  • this behavior is consistent with QBO UI. PFA snapshot in the above post. Thanks – Manas Mukherjee Sep 17 '13 at 09:44
  • I'm curious about this also for tangfb's comment, anyone have an answer? – Joseph Astrahan Apr 23 '15 at 09:37
  • The amount is calculated based on the line items in the invoice. To make the balance match, update the line items to match. – A Kaptur Jun 12 '17 at 21:56