Global API
...
Requests
Return Authorization
Update
1min
the following is an example of updating return authorization where we are changing some of the fields (see return authorization docid\ tvp5sq2fb4is2tiig2aqk for all available fields) the netsuite return authorization id (internalid) is required to update the return authorization note you can only update one record at a time the response returns the complete return authorization information but we have shortened the response in our example for ease of reading request // create a map to store all the data of a rma map\<string, object> nsrma = new map\<string, object>(); nsrma put('internalid', '86840'); nsrma put('classification', new map\<string, object>{'internalid'=>'2'}); nsrma put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nsrma put('department', new map\<string, object>{'internalid'=>'1'}); nsrma put('discountitem', new map\<string, object>{'internalid'=>' 6'}); nsrma put('discountrate', ' 20'); nsrma put('entity', new map\<string, object>{'internalid'=>'362'}); nsrma put('memo', 'order 30'); nsrma put('otherrefnum', '4343390'); nsrma put('trandate', datetime newinstance(2021, 09, 07) gettime()/1000); // initializing the rma custom fields list\<object> rmacustomfieldlist = new list\<object>(); map\<string,object> rmacustomfield = new map\<string,object>(); rmacustomfield put('fieldtype', 'select'); rmacustomfield put('scriptid', 'custbody customlist'); rmacustomfield put('valuelookup', new map\<string,object>{'internalid'=>'2'}); rmacustomfieldlist add(rmacustomfield); // adding the rma custom fields nsrma put('customfieldlist', new map\<string,object>{'customfield'=>rmacustomfieldlist}); // initializing the rma line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitem = new map\<string, object>(); lineitem put('description', 'a weapon for shooting arrows test'); lineitem put('item', new map\<string, object>{'internalid'=>'239'}); lineitem put('replaceall', false); lineitem put('amount', 10); lineitem put('quantity', 2); lineitem put('grossamt', 220); lineitem put('tax1amt', 210); lineitem put('revrecenddate', datetime newinstance(2021, 09, 07) gettime()/1000); lineitem put('revrecstartdate', datetime newinstance(2021, 09, 07) 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', 'custbody checkbox'); licustomfield put('value', 'true'); licustomfieldlist add(licustomfield); // adding the rma line item custom fields lineitem put('customfieldlist',new map\<string,object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to rma map\<string, object> rmalineitemlist = new map\<string, object>(); rmalineitemlist put('item',lineitemlist); nsrma put('itemlist',rmalineitemlist); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('returnauthorizations', new list\<object>{nsrma}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatereturnauthorization'); 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 = updatereturnauthorization, timestamp = 1621574690167, validrequest = true, version = 1 0, responsejson = { "status" "200", "errors" \[], "returnauthorizations" \[ { "tranid" "85", "trandate" 1630936800, "totalcostestimate" null, "total" 200, "taxtotal" 0, "subtotal" 220, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "status" "pending receipt", "source" "web services", "salesrep" null, "salesforceid" "a0m5y00000dwft2uag", "saleseffectivedate" 1630936800, "otherrefnum" "4343390", "orderstatus" " pendingreceipt", "nullfieldlist" null, "memo" "order 30", "location" null, "lastmodifieddate" 1621574677, "itemlist" { "replaceall" null, "item" \[ { "unitsdisplay" null, "taxrate1" "0 0", "taxcode" { "type" null, "name" "vat in\ undef in", "internalid" "5", "externalid" null }, "tax1amt" 0, "shipmethod" null, "shipgroup" null, "serialnumbers" null, "revrecstartdate" null, "revrecschedule" null, "revrecenddate" null, "rate" "100 00", "quantityremaining" null, "quantityreceived" 0, "quantitybilled" 0, "quantity" 2, "price" { "type" null, "name" "base price", "internalid" "1", "externalid" null }, "ponum" null, "orderline" null, "onhand" null, "location" null, "line" 4, "jobname" null, "itemreceive" null, "itemname" null, "itemisfulfilled" null, "item" { "type" null, "name" "bow", "internalid" "239", "externalid" null }, "grossamt" 220, "expectedreceiptdate" null, "description" "a weapon for shooting arrows test", "department" null, "customfieldlist" null, "createpo" null, "costestimatetype" null, "costestimate" null, "classification" null, "amount" 220 } ] }, "internalid" "86840", "externalid" null, "entity" { "type" null, "name" "21 atherton grocery", "internalid" "362", "externalid" null }, "discounttotal" 20, "discountrate" " 20 00", "discountitem" { "type" null, "name" "partner discount", "internalid" " 6", "externalid" null }, "department" { "type" null, "name" "pr department", "internalid" "1", "externalid" null }, "customform" { "type" null, "name" "custom return authorization credit", "internalid" "109", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" " ", "scriptid" "custbody breadwinner pc internal id", "internalid" "299", "fieldtype" null }, { "valuelookup" null, "value" "false", "scriptid" "custbody23", "internalid" "271", "fieldtype" null }, { "valuelookup" null, "value" "2021 05 20 22 24 37", "scriptid" "custbodylastmodifieddate", "internalid" "298", "fieldtype" null } ] }, "currencyrecord" null, "currencyname" "inr", "createdfrom" null, "createddate" 1621573302, "classification" { "type" null, "name" "individual partner class", "internalid" "2", "externalid" null } } ] } }