Global API
...
Requests
Customer
Update
1min
the following is an example of updating the customer where we are changing some of the fields (see customer docid\ hnjmkn99qxwdeafyyifsq for all available fields) the netsuite customer id (internalid) is required to update the customer note you can only update one record at a time the response returns the complete customer 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 customer map\<string, object> nscustomer = new map\<string, object>(); nscustomer put('internalid', '121357'); nscustomer put('companyname', 'grand hotels & resorts ltd'); nscustomer put('customform', new map\<string, object>{'internalid'=>' 2'}); nscustomer put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nscustomer put('pricelevel', new map\<string, object>{'internalid'=>'1'}); nscustomer put('receivablesaccount', new map\<string, object>{'internalid'=>'122'}); nscustomer put('subsidiary', new map\<string, object>{'internalid'=>'1'}); nscustomer put('startdate', datetime newinstance(2020, 12, 2) gettime()/1000); nscustomer put('terms', new map\<string, object>{'internalid'=>'5'}); nscustomer put('territory', new map\<string, object>{'internalid'=>' 5'}); nscustomer put('url', 'https //www grandhotel com'); // initialize the customer custom fields list\<object> custcustomfieldlist = new list\<object>(); map\<string, object> custcustomfield1 = new map\<string, object>(); custcustomfield1 put('fieldtype', 'select'); custcustomfield1 put('scriptid', 'custentityrating'); custcustomfield1 put('valuelookup', new map\<string, object>{'internalid'=>'2'}); custcustomfieldlist add(custcustomfield1); map\<string, object> custcustomfield2 = new map\<string, object>(); custcustomfield2 put('fieldtype', 'double'); custcustomfield2 put('scriptid', 'custentity decimal'); custcustomfield2 put('value', '76 89'); custcustomfieldlist add(custcustomfield2); // add the customer custom fields nscustomer put('customfieldlist', new map\<string, object>{'customfield'=>custcustomfieldlist}); // initialize the customer addresses list\<object> addressbooklist = new list\<object>(); map\<string, object> addressbook = new map\<string, object>(); map\<string, object> addressbookaddress = new map\<string, object>(); addressbookaddress put('addr1','2334 n michigan avenue, suite 1500'); addressbookaddress put('city','chicago'); addressbookaddress put('state','il'); addressbookaddress put('country',' unitedstates'); addressbookaddress put('zip','60601'); addressbook put('addressbookaddress',addressbookaddress); addressbook put('defaultbilling',true); addressbook put('defaultshipping',true); addressbook put('isresidential',true); addressbooklist add(addressbook); nscustomer put('addressbooklist', new map\<string,object>{'addressbook'=>addressbooklist});	 // initialize the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('customers', new list\<object>{nscustomer}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatecustomer'); 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=createcustomer, timestamp=1606907168426, validrequest=true, version=1 0, responsejson={ "status" "200", "errors" \[], "customers" \[ { "vatregnumber" null, "url" "https //www grandhotel com", "title" null, "territory" { "type" null, "name" "default round robin", "internalid" " 5", "externalid" null }, "terms" { "type" null, "name" "1% 10 net 30", "internalid" "5", "externalid" null }, "taxitem" null, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "startdate" 1606847400, "stage" " customer", "salutation" null, "salesrep" null, "salesforceid" "a012w00000xup93aah", "resalenumber" null, "reminderdays" null, "receivablesaccount" { "type" null, "name" "accounts receivable", "internalid" "122", "externalid" null }, "pricelevel" { "type" null, "name" "base price", "internalid" "1", "externalid" null }, "phone" null, "parent" null, "nullfieldlist" null, "middlename" null, "lastname" null, "lastmodifieddate" 1606907165, "itempricinglist" null, "isperson" false, "isinactive" false, "internalid" "32342", "firstname" null, "fax" null, "externalid" null, "entitystatus" { "type" null, "name" "customer closed won", "internalid" "13", "externalid" null }, "entityid" "cust533at grand hotels & resorts ltd", "enddate" null, "email" null, "datecreated" 1606907165, "customform" { "type" null, "name" "standard customer form", "internalid" " 2", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "76 89", "scriptid" "custentity decimal", "internalid" "435", "fieldtype" null }, { "valuelookup" { "type" null, "name" "acquired", "internalid" "2", "externalid" null }, "value" null, "scriptid" "custentityrating", "internalid" "42", "fieldtype" null } ] }, "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null }, "currencylist" { "currencyrecord" \[ { "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null } } ] }, "creditlimit" null, "creditholdoverride" " auto", "companyname" "grand hotels & resorts ltd", "category" null, "addressbooklist" { "replaceall" null, "addressbook" \[ { "label" "2334 n michigan avenue, suite 1500", "isresidential" true, "internalid" "29188", "defaultshipping" true, "defaultbilling" true, "addressbookaddress" { "zip" "60601", "state" "il", "internalid" null, "country" " unitedstates", "city" "chicago", "attention" null, "addrphone" null, "addressee" "grand hotels & resorts ltd", "addr3" null, "addr2" null, "addr1" "2334 n michigan avenue, suite 1500" } } ] }, "accountnumber" null } ] } }