Global API
...
Request
Credit Memo
Create
1min
the following is an example of create a credit memo where we are setting every possible field (see credit memo docid\ x6nlsr2vqhr25341roqd0 for the available fields) the response will return the exact request data plus the new quickbooks credit memo id (id) and the newly created salesforce credit memo id (salesforcerecordid) note you can only create one record at a time 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('txndate', '2021/08/11'); creditmemomap put('docnumber', '1201'); creditmemomap put('exchangerate', 1 0); // initializing the credit memo custom fields list\<object> customfieldlist = new list\<object>(); map\<string, object> customfiel1dmap = new map\<string, object>(); customfiel1dmap put('definitionid','1'); customfiel1dmap put('type','stringtype'); customfiel1dmap put('stringvalue','received'); customfieldlist add(customfiel1dmap); // adding the credit memo custom fields creditmemomap put('customfield',customfieldlist); creditmemomap put('address',new map\<string, object>{'freeformnumber' => '+919090909090'}); creditmemomap put('salestermref',new map\<string, object>{'value' => '4'}); creditmemomap put('customerref',new map\<string, object>{'value' => '29'}); // initializing the billing address map\<string, object> billaddrmap = new map\<string, object>(); billaddrmap put('city' , 'suryapet'); billaddrmap put('country' , 'india'); billaddrmap put('line3' , 'kodad'); billaddrmap put('line2' , 'first lane'); billaddrmap put('line1' , '1 24'); billaddrmap put('postalcode' , '508238'); billaddrmap put('countrysubdivisioncode' , ''); creditmemomap put('billaddr',billaddrmap); // initializing the credit memo 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'); 	 lineitemmap put('detailtype', 'salesitemlinedetail'); map\<string, object> saleslineitemdetailmap = new map\<string, object>(); saleslineitemdetailmap put('itemref' , new map\<string, object>{'value' => '1'}); 	 saleslineitemdetailmap put('taxcoderef' , new map\<string, object>{'value' => 'tax'}); saleslineitemdetailmap put('classref' , new map\<string, object>{'value' => '5000000000000193289'}); saleslineitemdetailmap put('servicedate','1993/05/25'); //yyyy/mm/dd saleslineitemdetailmap put('qty',2); saleslineitemdetailmap put('unitprice',50); saleslineitemdetailmap put('taxinclusiveamt',22); lineitemmap put('salesitemlinedetail', saleslineitemdetailmap); lineitemlist add(lineitemmap); // adding the line items to credit memo 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' , 'createcreditmemo'); 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=createcreditmemo, responsejson={ "statuscode" 200, "creditmemos" \[ { "txntaxdetail" { "totaltax" 0 }, "txndate" "2021 08 11", "totalamt" 100 00, "synctoken" "0", "sparse" false, "sfrecordid" "a0a5j000000vdppeae", "salesforcerecordid" "a0a5j000000vdppeae", "remainingcredit" 100 00, "metadata" { "lastupdatedtime" "2021 12 31t02 35 26 08 00", "createtime" "2021 12 31t02 35 26 08 00" }, "line" \[ { "salesitemlinedetail" { "unitprice" 50, "taxcoderef" { "value" "tax" }, "servicedate" "1993 05 25", "qty" 2, "itemref" { "value" "1", "name" "services" } }, "linenum" 1, "id" "1", "detailtype" "salesitemlinedetail", "description" "description", "amount" 100 00 }, { "detailtype" "subtotallinedetail", "amount" 100 00 } ], "id" "187", "emailstatus" "notset", "docnumber" "1201", "customfield" \[ { "type" "stringtype", "stringvalue" "received", "name" "crew #", "definitionid" "1" }, { "type" "stringtype", "name" "test 2", "definitionid" "2" }, { "type" "stringtype", "definitionid" "3" } ], "customerref" { "value" "29", "name" "weiskopf consulting" }, "currencyref" { "value" "usd", "name" "united states dollar" }, "billaddr" { "postalcode" "508238", "line3" "kodad", "line2" "first lane", "line1" "1 24", "id" "191", "country" "india", "city" "suryapet" }, "balance" 100 00 } ] }, timestamp=1640946928725, validrequest=true, version=1 0 } do you want to link a credit note to an invoice ? see here