Global API
...
Requests
Vendor Bill
Update
1min
the following is an example of an update vendor bill where we are changing some of the fields (see vendor bill docid\ wmela 0pauxvjse0u1fak for all available fields) the netsuite vendor bill id (internalid) is required to update the vendor bill note you can only update one record at a time the response returns the complete vendor bill 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 vendorbill map\<string, object> nsvendorbill = new map\<string, object>(); nsvendorbill put('internalid', '113553'); nsvendorbill put('classification', new map\<string, object>{'internalid'=>'2'}); nsvendorbill put('currencyrecord', new map\<string, object>{'internalid'=>'1'}); nsvendorbill put('entity', new map\<string, object>{'internalid'=>'362'}); nsvendorbill put('memo', 'bill 30'); nsvendorbill put('otherrefnum', '4343390'); nsvendorbill put('trandate', datetime newinstance(2021, 09, 07) gettime()/1000); // initializing the vendorbill 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 vendorbill custom fields nsvendorbill put('customfieldlist', new map\<string,object>{'customfield'=>billcustomfieldlist}); // initializing the vendorbill 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('replaceall', false); lineitem put('amount', 10); lineitem put('quantity', 2); lineitem put('grossamt', 220); lineitem put('tax1amt', 210); lineitem put('revrecenddate', datetime newinstance(2021, 09, 07) gettime()/1000); lineitem put('revrecstartdate', datetime newinstance(2021, 09, 07) gettime()/1000); // 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', 'custbody checkbox'); licustomfield put('value', 'true'); licustomfieldlist add(licustomfield); // adding the vendorbill line item custom fields lineitem put('customfieldlist',new map\<string,object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to vendorbill 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', 'updatevendorbill'); 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=updatevendorbill, timestamp=1667829702990, validrequest=true, version=1 0 responsejson= { "errors" \[], "status" "200", "vendorbills" \[ { "usertotal" 220 0, "transactionnumber" "vendbill188", "tranid" null, "trandate" 1630983600, "terms" null, "taxtotal" 33 56, "subsidiary" { "type" null, "name" "parent company", "internalid" "1", "externalid" null }, "status" "open", "salesforceid" "a025d00001zm4qbqat", "nullfieldlist" null, "memo" "bill 30", "location" null, "lastmodifieddate" 1667829698, "itemlist" { "replaceall" null, "item" \[ { "unitsdisplay" null, "taxrate1" "18 0", "taxcode" { "type" null, "name" "vat in\ gst 18", "internalid" "36", "externalid" null }, "tax1amt" 33 56, "shipmethod" null, "shipgroup" null, "serialnumbers" null, "revrecstartdate" null, "revrecschedule" null, "revrecenddate" null, "rate" "200 00", "quantityremaining" null, "quantityreceived" null, "quantitypicked" null, "quantitypacked" null, "quantityonhand" null, "quantityfulfilled" null, "quantitycommitted" null, "quantitybilled" null, "quantitybackordered" null, "quantityavailable" null, "quantity" 2 0, "price" null, "ponum" null, "percentcomplete" null, "orderline" null, "onhand" null, "location" null, "line" 9, "jobname" null, "itemreceive" null, "itemname" null, "itemisfulfilled" null, "item" { "type" null, "name" "bow", "internalid" "239", "externalid" null }, "grossamt" 220 0, "expectedreceiptdate" null, "description" "a weapon for shooting arrows test", "department" null, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "false", "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" 186 44 } ] }, "internalid" "113553", "fax" null, "externalid" null, "expenselist" null, "exchangerate" 1 0, "entity" { "type" null, "name" "rm textiles", "internalid" "30440", "externalid" null }, "email" null, "duedate" 1630983600, "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 } } ], }, }