Global API
...
Requests
Sales Order
Update
1min
the following is an example of update salesorder where we are changing some of the fields (see sales order docid\ emqjiknclze b zi9pinn for all available fields) the netsuite sales order id (internalid) is required to update the sales order note you can only update one record at a time the response returns the complete sales order 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 sales order map\<string, object> nssalesorder = new map\<string, object>(); nssalesorder put('internalid', '83943'); nssalesorder put('classification', new map\<string, object>{'internalid'=>'2'}); nssalesorder put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nssalesorder put('department', new map\<string, object>{'internalid'=>'1'}); nssalesorder put('discountitem', new map\<string, object>{'internalid'=>' 6'}); nssalesorder put('discountrate', ' 20'); nssalesorder put('entity', new map\<string, object>{'internalid'=>'362'}); nssalesorder put('memo', 'order 30'); nssalesorder put('otherrefnum', '4343390'); nssalesorder put('trandate', datetime newinstance(2021, 09, 07) gettime()/1000); // initialize the sales order custom fields list\<object> socustomfieldlist = new list\<object>(); map\<string,object> socustomfield = new map\<string,object>(); socustomfield put('fieldtype', 'select'); socustomfield put('scriptid', 'custbody customlist'); socustomfield put('valuelookup', new map\<string,object>{'internalid'=>'2'}); socustomfieldlist add(socustomfield); // add the sales order custom fields nssalesorder put('customfieldlist', new map\<string,object>{'customfield'=>socustomfieldlist}); // initialize the sales order 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('amount', 10); lineitem put('quantity', 2); lineitem put('grossamt', 220); lineitem put('tax1amt', 210); lineitem put('taxrate1', 1); lineitem put('revrecenddate', datetime newinstance(2021, 09, 07) gettime()/1000); lineitem put('revrecstartdate', datetime newinstance(2021, 09, 07) gettime()/1000); // initialize 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); // addg the sales order line item custom fields lineitem put('customfieldlist',new map\<string,object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // addg the line items to sales order map\<string, object> solineitemlist = new map\<string, object>(); solineitemlist put('item',lineitemlist); solineitemlist put('replaceall', false); nssalesorder put('itemlist',solineitemlist); // initialize the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('salesorders', new list\<object>{nssalesorder}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatesalesorder'); reqobj put('requestjson', reqjson); // place a request to breadwinner global api map\<string, object> resp = breadwinner ns breadwinnernetsuiteapi call(reqobj); system debug(resp); response { action = updatesalesorder, timestamp = 1621491360689, validrequest = true, version = 1 0, responsejson = { "status" "200", "errors" \[], "salesorders" \[ { "tranid" "1", "trandate" 1630953000, "total" 199 8, "taxtotal" 1 98, "subtotal" 217 82, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "status" "pending approval", "shippingcost" null, "shippingaddress" { "zip" "94567", "state" "ca", "internalid" null, "country" " unitedstates", "city" "pope valley", "attention" null, "addrphone" null, "addressee" "atherton grocery", "addr3" null, "addr2" "palo alto", "addr1" null }, "shipaddresslist" { "type" null, "name" "unnamed address", "internalid" "212", "externalid" null }, "salesrep" null, "salesforceid" "a0n5y00000xladruat", "otherrefnum" "4343390", "nullfieldlist" null, "memo" "order 30", "location" null, "lastmodifieddate" 1621491357, "itemlist" { "replaceall" null, "item" \[ { "unitsdisplay" null, "taxrate1" "1 0", "taxcode" { "type" null, "name" "vat in\ undef in", "internalid" "5", "externalid" null }, "tax1amt" 2 18, "shipmethod" null, "shipgroup" null, "serialnumbers" null, "revrecstartdate" null, "revrecschedule" null, "revrecenddate" null, "rate" "100 00", "quantityremaining" null, "quantityreceived" null, "quantitybilled" 0, "quantity" 2, "price" { "type" null, "name" "base price", "internalid" "1", "externalid" null }, "ponum" null, "orderline" null, "onhand" null, "location" null, "line" 38, "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" { "customfield" \[ { "valuelookup" null, "value" "1", "scriptid" "custcol gh line no", "internalid" "175", "fieldtype" null } ] }, "createpo" " dropshipment", "costestimatetype" null, "costestimate" null, "classification" null, "amount" 217 82 } ] }, "internalid" "83943", "handlingcost" null, "externalid" "1", "exchangerate" 1, "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 sales order 2", "internalid" "121", "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 19 23 15 57", "scriptid" "custbodylastmodifieddate", "internalid" "298", "fieldtype" null } ] }, "currencyrecord" null, "currencyname" "inr", "createdfrom" null, "createddate" 1620386017, "classification" { "type" null, "name" "individual partner class", "internalid" "2", "externalid" null }, "billingaddress" { "zip" "94567", "state" "ca", "internalid" null, "country" " unitedstates", "city" "pope valley", "attention" null, "addrphone" null, "addressee" "atherton grocery", "addr3" null, "addr2" "palo alto", "addr1" null }, "billaddresslist" { "type" null, "name" "unnamed address", "internalid" "212", "externalid" null } } ] } }