Global API
...
Requests
Cash Refund
Create
1min
to create a cash refund in netsuite, use action as "createcashrefund" and pass the cash refund data in the requestjson under "cashrefunds" note you can only create one record at a time the following is an example of creating a cash refund where we are setting every possible field (see cash refund docid\ t olxh qny0viz7wp1cvj for the available fields) the response will return the response back from netsuite, which includes netsuite cash refund id (internalid), plus the newly created salesforce cash refund id (salesforceid) request //create a map to store all the data of a cash refund map\<string, object> nscashrefund = new map\<string, object>(); nscashrefund put('classification', new map\<string, object>{'internalid'=>'5'}); nscashrefund put('department', new map\<string, object>{'internalid'=>'1'}); 	nscashrefund put('entity', new map\<string, object>{'internalid'=>'109118'}); 	nscashrefund put('location',new map\<string, object>{'internalid'=>'10'}); 	nscashrefund put('memo', 'cash refund 300'); nscashrefund put('otherrefnum', '4343400'); nscashrefund put('trandate', datetime newinstance(2023, 04, 26) gettime()/1000); // initializing the cash refund custom fields list\<object> crcustomfieldlist = new list\<object>(); map\<string,object> crcustomfield = new map\<string,object>(); crcustomfield put('fieldtype', 'boolean'); crcustomfield put('scriptid', 'custbody enableimport'); crcustomfield put('value', 'true'); crcustomfieldlist add(crcustomfield); // adding the cash refund custom fields nscashrefund put('customfieldlist', new map\<string,object>{'customfield'=>crcustomfieldlist}); // initializing the cash refund line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitem = new map\<string, object>(); lineitem put('item', new map\<string, object>{'internalid'=>'8823'}); lineitem put('quantity', 4); 	 lineitem put('amount', 500); 	 lineitem put('revrecenddate', datetime newinstance(2024, 04, 26) gettime()/1000); lineitem put('revrecstartdate', datetime newinstance(2024, 04, 26) gettime()/1000); // initializing the line item custom fields list\<object> licustomfieldlist = new list\<object>(); map\<string, object> licustomfield = new map\<string, object>(); licustomfield put('fieldtype', 'boolean'); licustomfield put('scriptid', 'custcol checkbox'); licustomfield put('value', 'false'); licustomfieldlist add(licustomfield); // adding the cash refund line item custom fields lineitem put('customfieldlist', new map\<string, object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to cash refund map\<string, object> crlineitemlist = new map\<string, object>(); crlineitemlist put('item', lineitemlist); nscashrefund put('itemlist', crlineitemlist); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('cashrefunds', new list\<object>{nscashrefund}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createcashrefund'); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { action=createcashrefund, timestamp= 1682496292136, validrequest=true, version=1 0, responsejson={ 	"errors" \[], 	"status" "200", 	"cashrefunds" \[{ 	 "tranid" "16", 	 "trandate" 1682478000, 	 "total" 500 0, 	 "taxtotal" 0 0, 	 "subtotal" 500 0, 	 "subsidiary" { 	 "type" null, 	 "name" "parent company", 	 "internalid" "1", 	 "externalid" null 	 }, 	 "status" null, 	 "shippingcost" 0 0, 	 "salesrep" null, 	 "salesforceid" "a061e000003ux0kaas", 	 "refundcheck" false, 	 "otherrefnum" "4343400", 	 "memo" "cash refund 300", 	 "location" { 	 "type" null, 	 "name" "hyderabad hi tech city", 	 "internalid" "10", 	 "externalid" null 	 }, 	 "lastmodifieddate" 1682496289, 	 "job" null, 	 "itemlist" { 	 "replaceall" null, 	 "item" \[{ 	 "unitsdisplay" null, 	 "taxrate1" "0 0%", 	 "taxcode" { 	 "type" null, 	 "name" "vat in\ undef in", 	 "internalid" "5", 	 "externalid" null 	 }, 	 "tax1amt" 0 0, 	 "shipmethod" null, 	 "shipgroup" null, 	 "serialnumbers" null, 	 "revrecstartdate" null, 	 "revrecschedule" null, 	 "revrecenddate" null, 	 "rate" null, 	 "quantityremaining" null, 	 "quantityreceived" null, 	 "quantitypicked" null, 	 "quantitypacked" null, 	 "quantityonhand" null, 	 "quantityfulfilled" null, 	 "quantitycommitted" null, 	 "quantitybilled" null, 	 "quantitybackordered" null, 	 "quantityavailable" null, 	 "quantity" 4 0, 	 "price" { 	 "type" null, 	 "name" null, 	 "internalid" " 1", 	 "externalid" null 	 }, 	 "ponum" null, 	 "percentcomplete" null, 	 "orderline" null, 	 "onhand" null, 	 "location" null, 	 "line" 1, 	 "jobname" null, 	 "itemreceive" null, 	 "itemname" null, 	 "itemisfulfilled" null, 	 "item" { 	 "type" null, 	 "name" "blue jeans", 	 "internalid" "8823", 	 "externalid" null 	 }, 	 "isclosed" null, 	 "grossamt" 500 0, 	 "expectedreceiptdate" null, 	 "description" "anything", 	 "department" null, 	 "customfieldlist" { 	 "customfield" \[{ 	 "valuelookup" null, 	 "value" "false", 	 "scriptid" "custcol checkbox", 	 "internalid" "443", 	 "fieldtype" null 	 }] 	 }, 	 "createpo" null, 	 "costestimatetype" " lastpurchaseprice", 	 "costestimate" 0 0, 	 "classification" null, 	 "billingschedule" null, 	 "amount" 500 0 	 }] 	 }, 	 "internalid" "121459", 	 "handlingcost" 0 0, 	 "externalid" null, 	 "exchangerate" 1 0, 	 "entity" { 	 "type" null, 	 "name" "cust1402at blue origin", 	 "internalid" "109118", 	 "externalid" null 	 }, 	 "discounttotal" 0 0, 	 "discountrate" null, 	 "discountitem" null, 	 "department" { 	 "type" null, 	 "name" "pr department", 	 "internalid" "1", 	 "externalid" null 	 }, 	 "customform" { 	 "type" null, 	 "name" "custom cash refund", 	 "internalid" "128", 	 "externalid" null 	 }, 	 "customfieldlist" { 	 "customfield" \[{ 	 "valuelookup" null, 	 "value" "500", 	 "scriptid" "custbody42", 	 "internalid" "869", 	 "fieldtype" null 	 }, 	 { 	 "valuelookup" null, 	 "value" " ", 	 "scriptid" "custbody breadwinner pc internal id", 	 "internalid" "588", 	 "fieldtype" null 	 }, 	 { 	 "valuelookup" null, 	 "value" "true", 	 "scriptid" "custbody enableimport", 	 "internalid" "691", 	 "fieldtype" null 	 } 	 ] 	 }, 	 "currencyrecord" { 	 "type" null, 	 "name" "inr", 	 "internalid" "1", 	 "externalid" null 	 }, 	 "currencyname" "inr", 	 "createdfrom" null, 	 "createddate" 1682496289, 	 "classification" { 	 "type" null, 	 "name" "corporate sales", 	 "internalid" "5", 	 "externalid" null 	 }, 	 "applylist" null, 	 "applied" null, 	 "account" { 	 "type" null, 	 "name" "cheque account", 	 "internalid" "1", 	 "externalid" null 	 } 	}] } }