Global API
...
Request
Purchase Order
Update
1min
the following is an example of update purchase order the quickbooks purchase order id (id), vendor reference id (vendorref) and sync token (synctoken) are required to update the purchase order (see purchase order docid\ j53axk0qebupb8e wav9 for the available fields) note you can only create one record at a time request // create a map to store all the data of a purchase order map\<string, object> purchaseordermap = new map\<string, object>(); list\<object> lineitemlist = new list\<object>(); list\<object> purchaseorderlist = new list\<object>(); // assign value of opportunity to quickbook purchaseorder purchaseordermap put('txndate','2024 04 26'); purchaseordermap put('duedate','2024 05 26'); purchaseordermap put('id','193'); purchaseordermap put('synctoken','0'); purchaseordermap put('purchaseorderemail' , new map\<string, object>{'emailaddress' =>'abc\@gmail com'}); purchaseordermap put('vendorref' , new map\<string, object>{'value' => '83' }); purchaseordermap put('privatenote' , 'updated'); // assign value of opportunitylineitem to quickbook purchaseorder map\<string, object> lineitemmap = new map\<string, object>(); map\<string, object> saleslineitemdetailmap = new map\<string, object>(); lineitemmap put('description','updated'); lineitemmap put('detailtype','itembasedexpenselinedetail'); lineitemmap put('amount',100); saleslineitemdetailmap put('itemref' , new map\<string, object>{'value' => '19' }); 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 purchaseorder purchaseordermap put('line',lineitemlist); purchaseorderlist add(purchaseordermap); map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('purchaseorder' , purchaseorderlist); 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' , 'updatepurchaseorder'); finalreqmap put('requestjson' , reqjson); // required, if quickbooks multi org is enabled in breadwinner finalreqmap put('qborgid' , '4620816365285051610'); finalreqmap put('skipdml' , false); system debug('request ' + finalreqmap); map\<string, object> respmap = breadwinner qbo breadwinnerqbapi call(finalreqmap); system debug('response ' + respmap); response { action=updatepurchaseorder, timestamp=1714122665865, validrequest=true, version=1 0, responsejson={ "statuscode" 200, "purchaseorder" \[ { "vendorref" { "value" "83", "name" "curl vendor" }, "txndate" "2024 04 26", "totalamt" 100 00, "synctoken" "1", "sparse"\ false, "sfrecordid" "a01f300000geyaeiad", "privatenote" "updated", "postatus" "open", "metadata" { "lastupdatedtime" "2024 04 26t02 11 04 07 00", "createtime" "2024 04 26t02 07 22 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", "description" "updated", "amount" 100 00 } ], "id" "193", "customfield" \[ ], "currencyref" { "value" "usd", "name" "united states dollar" }, "apaccountref" { "value" "33", "name" "accounts payable (a/p)" } } ] } }