Global API
...
Request
Credit Memo
Update
1min
the following is an example of update credit memo the quickbooks credit memo id (id) is required to update the credit memo(see credit memo docid\ x6nlsr2vqhr25341roqd0 for the available fields) the request body must include all writable fields of the credit memo object writable fields omitted from the request body are set to null 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 credit memo list\<object> creditmemolist = new list\<object>(); map\<string, object> creditmemomap = new map\<string, object>(); creditmemomap put('id', '13'); 	creditmemomap put('synctoken','2'); 	creditmemomap 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 creditmemomap put('line',lineitemlist); creditmemolist add(creditmemomap); // initializing the requestjson data to be passed map\<string, object> reqjsonmap = new map\<string, object>(); reqjsonmap put('creditmemos' , creditmemolist); 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' , 'updatecreditmemo'); finalreqmap put('requestjson' , reqjson); finalreqmap put('skipdml' , false); //required, if quickbooks multi org is enabled in breadwinner finalreqmap put('qborgid', '4620816365285051610'); system debug('request ' + finalreqmap); // placing a request to breadwinner global api map\<string, object> respmap = breadwinner qbo breadwinnerqbapi call(finalreqmap); system debug('response ' + respmap); response { action=updatecreditmemo, responsejson={ "statuscode" 200, "creditmemos" \[ { "txntaxdetail" { "totaltax" 0 }, "txndate" "2021 12 31", "totalamt" 100 00, "synctoken" "2", "sparse" false, "shipaddr" { "postalcode" "94482", "longitude" " 122 0642815", "line1" "370 easy st ", "lat" "37 4031672", "id" "9", "countrysubdivisioncode" "ca", "city" "middlefield" }, "sfrecordid" "a0a5j000000vdppeae", "salesforcerecordid" "a0a5j000000vdppeae", "remainingcredit" 100 00, "metadata" { "lastupdatedtime" "2021 12 31t02 46 20 08 00", "createtime" "2021 12 31t02 35 26 08 00" }, "line" \[ { "salesitemlinedetail" { "unitprice" 50, "taxcoderef" { "value" "tax" }, "qty" 2, "itemref" { "value" "1", "name" "services" } }, "linenum" 1, "id" "3", "detailtype" "salesitemlinedetail", "description" "description updated", "amount" 100 00 }, { "detailtype" "subtotallinedetail", "amount" 100 00 } ], "id" "187", "emailstatus" "notset", "docnumber" "1201", "customfield" \[ { "type" "stringtype", "name" "crew #", "definitionid" "1" }, { "type" "stringtype", "name" "test 2", "definitionid" "2" }, { "type" "stringtype", "definitionid" "3" } ], "customerref" { "value" "9", "name" "55 twin lane" }, "currencyref" { "value" "usd", "name" "united states dollar" }, "billaddr" { "postalcode" "94482", "longitude" " 122 0642815", "line1" "370 easy st ", "lat" "37 4031672", "id" "9", "countrysubdivisioncode" "ca", "city" "middlefield" }, "balance" 100 00 } ] }, timestamp=1640947582773, validrequest=true, version=1 0 }