Global API
...
Request
Bill
Update
1min
the following is an example of updating a bill the quickbooks bill id (id), vendor reference id (vendorref) and sync token (synctoken) are required to update the bill (see bill docid\ mpzpcquzr oqlfeonw3y9 for the available fields) note you can only update one record at a time when you want to update specific fields of an entity without affecting others, use a sparse update operation by setting sparse= 'true' in your request this approach is more efficient and less prone to unintended changes than a full update request // create a map to store all the data of a bill map\<string, object> billmap = new map\<string, object>(); list\<object> lineitemlist = new list\<object>(); list\<object> billlist = new list\<object>(); // assign value of opportunity to quickbook bill billmap put('txndate','2024 04 26'); billmap put('duedate','2024 05 26'); billmap put('id','191'); billmap put('synctoken','0'); billmap put('trackingnumber','12'); billmap put('globaltaxcalculation','taxinclusive'); billmap put('salestermref' , new map\<string, object>{'value' => '2' }); billmap put('vendorref' , new map\<string, object>{'value' => '83' }); billmap put('privatenote' , 'updated'); // assign value of opportunitylineitem to quickbook bill map\<string, object> lineitemmap = new map\<string, object>(); map\<string, object> saleslineitemdetailmap = new map\<string, object>(); lineitemmap put('detailtype','itembasedexpenselinedetail'); lineitemmap put('amount',100); saleslineitemdetailmap put('itemref' , new map\<string, object>{'value' => '19' }); saleslineitemdetailmap put('taxcoderef', new map\<string, object>{'value' => 'non' }); saleslineitemdetailmap put('qty','10'); saleslineitemdetailmap put('unitprice','10'); if(lineitemmap get('detailtype') == 'salesitemlinedetail'){ 	 lineitemmap put('salesitemlinedetail',saleslineitemdetailmap); 	 }else if(lineitemmap get('detailtype') == 'itembasedexpenselinedetail'){ 	 lineitemmap put('itembasedexpenselinedetail',saleslineitemdetailmap); 	 } lineitemlist add(lineitemmap); 	 // adding the line items to quickbook bill billmap put('line',lineitemlist); billlist add(billmap); map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('bill' , billlist); 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' , 'updatebill'); finalreqmap put('requestjson' , reqjson); finalreqmap put('qborgid' , '4620816365285051610'); // required, if quickbooks multi org is enabled in breadwinner finalreqmap put('skipdml' , false); system debug('request ' + finalreqmap); map\<string, object> respmap = breadwinner qbo breadwinnerqbapi call(finalreqmap); system debug('response ' + respmap); response { action=updatebill, timestamp=1714122038660, validrequest=true, version=1 0 responsejson={ "statuscode" 200, "bill" \[ { "vendorref" { "value" "83", "name" "curl vendor" }, "txndate" "2024 04 26", "totalamt" 100 00, "synctoken" "1", "sparse"\ false, "sfrecordid" "a01f300000geyzgial", "salestermref" { "value" "2" }, "privatenote" "updated", "metadata" { "lastupdatedtime" "2024 04 26t02 00 35 07 00", "createtime" "2024 04 26t01 41 33 07 00" }, "line" \[ { "linenum" 1, "itembasedexpenselinedetail" { "unitprice" 10, "taxcoderef" { "value" "non" }, "qty" 10, "itemref" { "value" "19", "name" "genwatt diesel 1000kw" }, "billablestatus" "notbillable" }, "id" "2", "detailtype" "itembasedexpenselinedetail", "amount" 100 00 } ], "id" "191", "duedate" "2024 05 26", "currencyref" { "value" "usd", "name" "united states dollar" }, "balance" 100 00, "apaccountref" { "value" "33", "name" "accounts payable (a/p)" } } ] } }