Global API
...
Requests
Vendor
Create
1min
to create a vendor in netsuite, use action as "createvendor" and pass the vendor data in the requestjson under "vendors" note you can only create one record at a time the following is an example of creating a vendor where we are setting every possible field (see vendor docid\ c d4tmrw1zb71v 7pn2ty for the available fields) the response will return the response back from netsuite, which includes the new netsuite vendor id (internalid), plus the newly created salesforce vendor id (salesforceid) request // create a map to store all the data of a vendor map\<string, object> nsvendor = new map\<string, object>(); nsvendor put('companyname', 'pyramid construction inc '); nsvendor put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nsvendor put('payablesaccount', new map\<string, object>{'internalid'=>'114'}); nsvendor put('subsidiary', new map\<string, object>{'internalid'=>'1'}); nsvendor put('terms', new map\<string, object>{'internalid'=>'6'}); nsvendor put('url', 'https //www pyramid com'); // initializing the vendor custom fields list\<object> vendcustomfieldlist = new list\<object>(); map\<string, object> vendcustomfield1 = new map\<string, object>(); vendcustomfield1 put('fieldtype', 'select'); vendcustomfield1 put('scriptid', 'custentity atlas pbcs category'); vendcustomfield1 put('valuelookup', new map\<string, object>{'internalid'=>'1'}); vendcustomfieldlist add(vendcustomfield1); map\<string, object> vendcustomfield2 = new map\<string, object>(); vendcustomfield2 put('fieldtype', 'date'); vendcustomfield2 put('scriptid', 'custentity renewal date'); vendcustomfield2 put('value', string valueof(datetime newinstance(2020, 12, 31) gettime()/1000)); vendcustomfieldlist add(vendcustomfield2); // adding the vendor custom fields nsvendor put('customfieldlist', new map\<string, object>{'customfield'=>vendcustomfieldlist}); // initializing the vendor 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); nsvendor put('addressbooklist', new map\<string, object>{'addressbook'=>addressbooklist});	 // 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', 'createvendor'); 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=createvendor, timestamp=1607419613160, validrequest=true, version=1 0, responsejson={ "status" "200", "errors" \[], "vendors" \[ { "url" "https //www pyramid com", "title" null, "terms" { "type" null, "name" "2% 10 net 30", "internalid" "6", "externalid" null }, "taxitem" null, "taxidnum" null, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "salutation" null, "salesforceid" "a012w00000xundlaa1", "phone" null, "payablesaccount" { "type" null, "name" "accounts payable", "internalid" "114", "externalid" null }, "nullfieldlist" null, "mobilephone" null, "middlename" null, "legalname" null, "lastname" null, "lastmodifieddate" 1607419610, "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" null, "datecreated" 1607419609, "customform" { "type" null, "name" "custom vendor form", "internalid" "4", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "1609353000", "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 } ] }, "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null }, "currencylist" { "vendorcurrency" \[ { "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null } } ], "currencyrecord" null }, "creditlimit" null, "companyname" "pyramid construction inc ", "category" 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 } ] } }