website logo
Product Overview
NetSuite
Payments
QuickBooks
Xero
Navigate through spaces
⌘K
Guided Wizard
Guided Wizard Settings
Bill Configuration
Custom Guided Wizard
Button URL Structure
Button URL Generator
Support
Global API
API Overview
Request
Response
Code Examples
Technical Resources
Breadwinner Setup
Requirements
ERD / Object Structure
Getting Help
Version History
Docs powered by archbee 

Update

1min

The following is an example of update Invoice. The QuickBooks Invoice Id (id) is required to update the Invoice (See Invoice for the available fields).

Request
Response
|
//  Create a Map to store all the data of a Invoice
List<Object> invoiceList = new List<Object>();
Map<String, Object> invoiceMap = new Map<String, Object>();
    invoiceMap.put('Id', '13');
	invoiceMap.put('SyncToken','2');
	invoiceMap.put('CustomerRef',new Map<String, Object>{'value' => '9'});

    //  Initializing the Invoice Line Items
    List<Object> lineItemList = new List<Object>();
        Map<String, Object> lineItemMap = new Map<String, Object>();
		lineItemMap.put('LineNum',1);
        lineItemMap.put('Amount',100);
        lineItemMap.put('Description','Description Updated');
		lineItemMap.put('DetailType', 'SalesItemLineDetail');
		Map<String, Object> salesLineItemDetailMap = new Map<String, Object>();
            salesLineItemDetailMap.put('Qty',2);
            salesLineItemDetailMap.put('UnitPrice',50);
			salesLineItemDetailMap.put('TaxCodeRef' , new Map<String, Object>{'value' => 'TAX'});
        
        lineItemMap.put('SalesItemLineDetail', salesLineItemDetailMap);
        lineItemList.add(lineItemMap);

    //  Adding the Line Items to Invoice
    invoiceMap.put('Line',lineItemList);
    invoiceList.add(invoiceMap);

//  Initializing the RequestJSON Data to be passed.
    Map<String, Object> reqJSONMap = new Map<String, Object>(); 
    reqJSONMap.put('invoices' , invoiceList); 
    String reqJSON = JSON.serialize(reqJSONMap); 

    Map<String, Object> finalReqMap = new Map<String, Object>(); 
    Map<String, Object> reqOptions = new Map<String, Object>(); 
    finalReqMap.put('options' , reqOptions); 
    finalReqMap.put('version' , '1.0'); 
    finalReqMap.put('action' , 'updateinvoice'); 
    finalReqMap.put('RequestJSON' , reqJSON); 
    finalReqMap.put('skipDML' , false);
    //Required, if QuickBooks Multi-Org is enabled in Breadwinner. 
    finalReqMap.put('qbOrgId', '!aa00TM'); 
    System.debug('Request ::: ' + finalReqMap);

//  Placing a request to Breadwinner Global API
    Map<String, Object> respMap = breadwinner_qbo.BreadwinnerQBAPI.call(finalReqMap);
    System.debug('Response ::: ' + respMap);




Updated 02 Jun 2023
Did this page help you?
Yes
No
PREVIOUS
Create
NEXT
Sales Receipt
Docs powered by archbee