Global API
...
Requests
Return Authorization

Create

1min
to create an rma in netsuite, use action as "createreturnauthorization" and pass the rma data in the requestjson under "returnauthorizations" note you can only create one record at a time the following is an example of creating return authorization where we are setting every possible field (see return authorization docid\ tvp5sq2fb4is2tiig2aqk for the available fields) the response will return the response back from netsuite, which includes the new netsuite return authorization id (internalid), plus the newly created salesforce return authorization id (salesforceid) request // create a map to store all the data of a rma map\<string, object> nsrma = new map\<string, object>(); nsrma put('classification', new map\<string, object>{'internalid'=>'1'}); 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', ' 15'); nsrma put('entity', new map\<string, object>{'internalid'=>'362'}); nsrma put('memo', 'order 25'); nsrma put('otherrefnum', '4343399'); nsrma put('trandate', datetime newinstance(2020, 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'); lineitem put('item', new map\<string, object>{'internalid'=>'239'}); lineitem put('quantity', 1); // 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', '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', 'createreturnauthorization'); reqobj put('requestjson', reqjson); // placing a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { &#x9;action = createreturnauthorization, &#x9;timestamp = 1613541991118, &#x9;validrequest = true, &#x9;version = 1 0, &#x9;responsejson = { &#x9; "status" "200", &#x9; "errors" \[], &#x9; "returnauthorizations" \[ &#x9; { &#x9; "tranid" "65", &#x9; "trandate" 1599447600, &#x9; "totalcostestimate" null, &#x9; "total" 85, &#x9; "taxtotal" 0, &#x9; "subtotal" 100, &#x9; "subsidiary" { &#x9; "type" null, &#x9; "name" "parent company", &#x9; "internalid" "1", &#x9; "externalid" null &#x9; }, &#x9; "status" "pending receipt", &#x9; "source" "web services", &#x9; "salesrep" null, &#x9; "salesforceid" "a0l4x000000miybeai", &#x9; "saleseffectivedate" 1599447600, &#x9; "otherrefnum" "4343399", &#x9; "orderstatus" " pendingreceipt", &#x9; "nullfieldlist" null, &#x9; "memo" "order 25", &#x9; "location" null, &#x9; "lastmodifieddate" 1613541969, &#x9; "itemlist" { &#x9; "replaceall" null, &#x9; "item" \[ &#x9; { &#x9; "unitsdisplay" null, &#x9; "taxrate1" "0 0", &#x9; "taxcode" { &#x9; "type" null, &#x9; "name" "vat in\ undef in", &#x9; "internalid" "5", &#x9; "externalid" null &#x9; }, &#x9; "tax1amt" 0, &#x9; "shipmethod" null, &#x9; "shipgroup" null, &#x9; "serialnumbers" null, &#x9; "revrecstartdate" null, &#x9; "revrecschedule" null, &#x9; "revrecenddate" null, &#x9; "rate" "100 00", &#x9; "quantityremaining" null, &#x9; "quantityreceived" 0, &#x9; "quantitybilled" 0, &#x9; "quantity" 1, &#x9; "price" { &#x9; "type" null, &#x9; "name" "base price", &#x9; "internalid" "1", &#x9; "externalid" null &#x9; }, &#x9; "ponum" null, &#x9; "orderline" null, &#x9; "onhand" null, &#x9; "location" null, &#x9; "line" 1, &#x9; "jobname" null, &#x9; "itemreceive" null, &#x9; "itemname" null, &#x9; "itemisfulfilled" null, &#x9; "item" { &#x9; "type" null, &#x9; "name" "bow", &#x9; "internalid" "239", &#x9; "externalid" null &#x9; }, &#x9; "grossamt" 100, &#x9; "expectedreceiptdate" null, &#x9; "description" "a weapon for shooting arrows", &#x9; "department" null, &#x9; "customfieldlist" { &#x9; "customfield" \[ &#x9; { &#x9; valuelookup" null, &#x9; "value" "1", &#x9; "scriptid" "custcol gh line no", &#x9; "internalid" "175", &#x9; "fieldtype" null &#x9; }, &#x9; { &#x9; "valuelookup" null, &#x9; "value" "12320000000000117 72960", &#x9; "scriptid" "custcol gh so line id", &#x9; "internalid" "200", &#x9; "fieldtype" null &#x9; }, &#x9; { &#x9; "valuelookup" null, &#x9; "value" "false", &#x9; "scriptid" "custcol checkbox", &#x9; "internalid" "443", &#x9; "fieldtype" null &#x9; } &#x9; ] &#x9; }, &#x9; "createpo" null, &#x9; "costestimatetype" null, &#x9; "costestimate" null, &#x9; "classification" null, &#x9; "amount" 100 &#x9; } &#x9; ] &#x9; }, &#x9; "internalid" "70374", &#x9; "externalid" null, &#x9; "entity" { &#x9; "type" null, &#x9; "name" "21 atherton grocery", &#x9; "internalid" "362", &#x9; "externalid" null &#x9; }, &#x9; "discounttotal" 15, &#x9; "discountrate" " 15 00", &#x9; "discountitem" { &#x9; "type" null, &#x9; "name" "partner discount", &#x9; "internalid" " 6", &#x9; "externalid" null &#x9; }, &#x9; "department" { &#x9; "type" null, &#x9; "name" "pr department", &#x9; "internalid" "1", &#x9; "externalid" null &#x9; }, &#x9; "customform" { &#x9; "type" null, &#x9; "name" "custom return authorization credit", &#x9; "internalid" "109", &#x9; "externalid" null &#x9; }, &#x9; "customfieldlist" { &#x9; "customfield" \[ &#x9; { &#x9; "valuelookup" { &#x9; "type" null, &#x9; "name" "b", &#x9; "internalid" "2", &#x9; "externalid" null &#x9; }, &#x9; "value" null, &#x9; "scriptid" "custbody customlist", &#x9; "internalid" "458", &#x9; "fieldtype" null &#x9; }, &#x9; { &#x9; "valuelookup" null, &#x9; "value" "false", &#x9; "scriptid" "custbody checkbox", &#x9; "internalid" "272", &#x9; "fieldtype" null &#x9; } &#x9; ] &#x9; }, &#x9; "currencyrecord" null, &#x9; "currencyname" "inr", &#x9; "createdfrom" null, &#x9; "createddate" 1613541969, &#x9; "classification" { &#x9; "type" null, &#x9; "name" "partner class", &#x9; "internalid" "1", &#x9; "externalid" null &#x9; } &#x9; } &#x9; ] &#x9;} }