Global API
...
Requests
Vendor Bill

Create

1min
to create a vendor bill in netsuite, use action as "createvendorbill" and pass the vendor bill data in the requestjson under "vendorbills" note you can only create one record at a time the following is an example of create vendor bill where we are setting every possible field (see vendor bill docid\ wmela 0pauxvjse0u1fak for the available fields) the response will return the response back from netsuite, which includes the new netsuite vendor bill id (internalid), plus the newly created salesforce vendor bill id (salesforceid) request // create a map to store all the data of a vendor bill map\<string, object> nsvendorbill = new map\<string, object>(); nsvendorbill put('classification', new map\<string, object>{'internalid'=>'5'}); nsvendorbill put('location', new map\<string, object>{'internalid'=>'13'}); nsvendorbill put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nsvendorbill put('department', new map\<string, object>{'internalid'=>'2'}); nsvendorbill put('duedate', datetime newinstance(2020, 12, 31) gettime()/1000); nsvendorbill put('approvalstatus', new map\<string, object>{'internalid'=>'2'}); nsvendorbill put('entity', new map\<string, object>{'internalid'=>'30440'}); nsvendorbill put('shipto', new map\<string, object>{'internalid'=>'362'}); nsvendorbill put('memo', 'bill 12'); nsvendorbill put('otherrefnum', '4343399'); nsvendorbill put('trandate', datetime newinstance(2020, 09, 07) gettime()/1000); // initializing the vendor bill custom fields list\<object> billcustomfieldlist = new list\<object>(); map\<string, object> billcustomfield = new map\<string, object>(); billcustomfield put('fieldtype', 'select'); billcustomfield put('scriptid', 'custbody customlist'); billcustomfield put('valuelookup', new map\<string, object>{'internalid'=>'2'}); billcustomfieldlist add(billcustomfield); // adding the vendor bill custom fields nsvendorbill put('customfieldlist', new map\<string, object>{'customfield'=>billcustomfieldlist}); // initializing the vendor bill 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); lineitem put('rate', '999'); // 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 vendor bill line item custom fields lineitem put('customfieldlist', new map\<string, object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to vendor bill map\<string, object> billlineitemlist = new map\<string, object>(); billlineitemlist put('item', lineitemlist); nsvendorbill put('itemlist', billlineitemlist); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('vendorbills', new list\<object>{nsvendorbill}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createvendorbill'); 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=createvendorbill, timestamp = 1621574690167, validrequest = true, version = 1 0, responsejson={ "status" "200", "errors" \[], "vendorbills" \[ { "usertotal" 1178 82, "transactionnumber" "vendbill188", "tranid" null, "trandate" 1599447600, "terms" null, "taxtotal" 179 82, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "status" "open", "salesforceid" "a025d00001zm4qbqat", "nullfieldlist" null, "memo" "bill 12", "location" null, "lastmodifieddate" 1667824104, "itemlist" { "replaceall" null, "item" \[ { "unitsdisplay" null, "taxrate1" "18 0", "taxcode" { "type" null, "name" "vat in\ gst 18", "internalid" "36", "externalid" null }, "tax1amt" 179 82, "shipmethod" null, "shipgroup" null, "serialnumbers" null, "revrecstartdate" null, "revrecschedule" null, "revrecenddate" null, "rate" "999 00", "quantityremaining" null, "quantityreceived" null, "quantitypicked" null, "quantitypacked" null, "quantityonhand" null, "quantityfulfilled" null, "quantitycommitted" null, "quantitybilled" null, "quantitybackordered" null, "quantityavailable" null, "quantity" 1 0, "price" null, "ponum" null, "percentcomplete" null, "orderline" null, "onhand" null, "location" null, "line" 1, "jobname" null, "itemreceive" null, "itemname" null, "itemisfulfilled" null, "item" { "type" null, "name" "bow", "internalid" "239", "externalid" null }, "grossamt" 1178 82, "expectedreceiptdate" null, "description" "a weapon for shooting arrows", "department" null, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "true", "scriptid" "custcol checkbox", "internalid" "443", "fieldtype" null }, { "valuelookup" null, "value" "error field 'custcol7' not found", "scriptid" "custcol11", "internalid" "656", "fieldtype" null } ] }, "createpo" null, "costestimatetype" null, "costestimate" null, "classification" null, "amount" 999 0 } ] }, "internalid" "113553", "fax" null, "externalid" null, "expenselist" null, "exchangerate" 1 0, "entity" { "type" null, "name" "rm textiles", "internalid" "30440", "externalid" null }, "email" null, "duedate" 1609383600, "department" null, "customform" { "type" null, "name" "standard vendor bill", "internalid" "50", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "false", "scriptid" "custbody34", "internalid" "558", "fieldtype" null }, { "valuelookup" null, "value" " ", "scriptid" "custbody breadwinner pc internal id", "internalid" "588", "fieldtype" null }, { "valuelookup" { "type" null, "name" "b", "internalid" "2", "externalid" null }, "value" null, "scriptid" "custbody customlist", "internalid" "458", "fieldtype" null }, { "valuelookup" null, "value" "false", "scriptid" "custbody enableimport", "internalid" "691", "fieldtype" null }, { "valuelookup" null, "value" "false", "scriptid" "custbody checkbox", "internalid" "272", "fieldtype" null } ] }, "currencyrecord" { "type" null, "name" "inr", "internalid" "1", "externalid" null }, "currencyname" "inr", "createddate" 1667824104, "classification" null, "billingaddress" null, "approvalstatus" { "type" null, "name" "approved", "internalid" "2", "externalid" null } } ], } }