Global API
...
Requests
Vendor
Update
1min
the following is an example of updating a vendor where we are changing some of the fields (see vendor docid\ c d4tmrw1zb71v 7pn2ty for all available fields) the netsuite vendor id (internalid) is required to update the vendor note you can only update one record at a time the response returns the complete vendor 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 vendor map\<string, object> nsvendor = new map\<string, object>(); 	nsvendor put('internalid', '32442'); nsvendor put('currencyrecord', new map\<string, object>{'internalid'=>'2'}); nsvendor put('terms', new map\<string, object>{'internalid'=>'5'}); nsvendor put('category', new map\<string, object>{'internalid'=>'4'}); nsvendor put('email', 'john\@pyramid com'); nsvendor put('phone', '7897734343'); // initializing the vendor custom fields list\<object> vendcustomfieldlist = new list\<object>(); map\<string, object> vendcustomfield1 = new map\<string, object>(); vendcustomfield1 put('fieldtype', 'date'); vendcustomfield1 put('scriptid', 'custentity renewal date'); vendcustomfield1 put('value', string valueof(datetime newinstance(2020, 12, 26) gettime()/1000)); vendcustomfieldlist add(vendcustomfield1); map\<string,object> vendcustomfield2 = new map\<string, object>(); vendcustomfield2 put('fieldtype', 'string'); vendcustomfield2 put('scriptid', 'custentity vendor description'); vendcustomfield2 put('value', 'vendor for the construction materials'); vendcustomfieldlist add(vendcustomfield2); // adding the vendor custom fields nsvendor put('customfieldlist', new map\<string, object>{'customfield'=>vendcustomfieldlist}); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('vendors', new list\<object>{nsvendor}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updatevendor'); 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=updatevendor, timestamp=1607420691759, validrequest=true, version=1 0, responsejson={ "status" "200", "errors" \[], "vendors" \[ { "url" "https //www pyramid com", "title" null, "terms" { "type" null, "name" "1% 10 net 30", "internalid" "5", "externalid" null }, "taxitem" null, "taxidnum" null, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "salutation" null, "salesforceid" "a012w00000xundlaa1", "phone" "7897734343", "payablesaccount" { "type" null, "name" "accounts payable", "internalid" "114", "externalid" null }, "nullfieldlist" null, "mobilephone" null, "middlename" null, "legalname" null, "lastname" null, "lastmodifieddate" 1607420689, "isperson" false, "isjobresourcevend" false, "isinactive" false, "isaccountant" null, "is1099eligible" null, "internalid" "32442", "incoterm" null, "homephone" null, "firstname" null, "fax" null, "externalid" null, "expenseaccount" null, "entityid" "pyramid construction inc ", "email" "john\@pyramid com", "datecreated" 1607419609, "customform" { "type" null, "name" "custom vendor form", "internalid" "4", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "1608921000", "scriptid" "custentity renewal date", "internalid" "434", "fieldtype" null }, { "valuelookup" { "type" null, "name" "forecast", "internalid" "1", "externalid" null }, "value" null, "scriptid" "custentity atlas pbcs category", "internalid" "131", "fieldtype" null }, { "valuelookup" null, "value" "vendor for the construction materials", "scriptid" "custentity vendor description", "internalid" "437", "fieldtype" null } ] }, "currencyrecord" { "type" null, "name" "us dollars", "internalid" "2", "externalid" null }, "currencylist" { "vendorcurrency" \[ { "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null } }, { "currencyrecord" { "type" null, "name" "us dollars", "internalid" "2", "externalid" null } } ], "currencyrecord" null }, "creditlimit" null, "companyname" "pyramid construction inc ", "category" { "type" null, "name" "supplies", "internalid" "4", "externalid" null }, "bcn" null, "addressbooklist" { "replaceall" null, "addressbook" \[ { "label" "2334 n michigan avenue, suite 1500", "isresidential" null, "internalid" "29789", "defaultshipping" true, "defaultbilling" true, "addressbookaddress" { "zip" "60601", "state" "il", "internalid" null, "country" " unitedstates", "city" "chicago", "attention" null, "addrphone" null, "addressee" "pyramid construction inc ", "addr3" null, "addr2" null, "addr1" "2334 n michigan avenue, suite 1500" } } ] }, "accountnumber" null } ] } }