Global API
...
Requests
Invoice
Update
1 min
the following is an example of update invoice where we are changing some of the fields (see https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/fgc9eqdmrkfq6ct2cri5h invoice docid\ xsrer45ur9lxkfahmkbrh for all available fields) the netsuite invoice id (internalid) is required to update the invoice note you can only update one record at a time the response returns the complete invoice 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 invoice map\<string, object> nsinvoice = new map\<string, object>(); 	nsinvoice put('internalid', '91404'); nsinvoice put('classification', new map\<string, object>{'internalid'=>'2'}); nsinvoice put('department', new map\<string, object>{'internalid'=>'1'}); 	nsinvoice put('memo', 'invoice 215'); nsinvoice put('otherrefnum', '4343400'); nsinvoice put('trandate', datetime newinstance(2020, 10, 07) gettime()/1000); // initializing the invoice custom fields list\<object> invcustomfieldlist = new list\<object>(); map\<string,object> invcustomfield = new map\<string,object>(); invcustomfield put('fieldtype', 'boolean'); invcustomfield put('scriptid', 'custbody checkbox'); invcustomfield put('value', 'true'); invcustomfieldlist add(invcustomfield); // adding the invoice custom fields nsinvoice put('customfieldlist', new map\<string,object>{'customfield'=>invcustomfieldlist}); // initializing the invoice line items list\<object> lineitemlist = new list\<object>(); map\<string, object> lineitem = new map\<string, object>(); lineitem put('description', ' for shooting arrows'); lineitem put('line', 1); // updates the existing line item with line number as 1 lineitem put('quantity', 6); 	 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', 'custcol checkbox'); licustomfield put('value', 'false'); licustomfieldlist add(licustomfield); // adding the invoice line item custom fields lineitem put('customfieldlist', new map\<string, object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding another line item 	lineitem = new map\<string, object>(); lineitem put('item', new map\<string, object>{'internalid'=>'444'}); lineitem put('quantity', 4); lineitem put('price', new map\<string, object>{'internalid'=>'2'}); lineitemlist add(lineitem); // adding the line items to invoice map\<string, object> invlineitemlist = new map\<string, object>(); invlineitemlist put('item', lineitemlist); 	 invlineitemlist put('replaceall', false); nsinvoice put('itemlist', invlineitemlist); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('invoices', new list\<object>{nsinvoice}); string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'updateinvoice'); 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=updateinvoice, timestamp=1639492143080, validrequest=true, version=1 0,	 responsejson={ "errors" \[], "status" "200",	 "invoices" \[ { "undepfunds"\ null, "tranid" "inv432", "trandate" 1601956800, "total" 48 0, "terms"\ null, "taxtotal" 0 0, "subtotal" 48 0, "subsidiary" { "type"\ null, "name" "parent company", "internalid" "1", "externalid"\ null }, "status" "pending approval", "shippingcost"\ null, "shippingaddress"\ null, "salesrep" { "type"\ null, "name" "navaneeth d", "internalid" "4", "externalid"\ null }, "salesforceid" "a0b0l00000avfe1ean", "otherrefnum" "4343400", "nullfieldlist"\ null, "memo" "invoice 215", "location" { "type"\ null, "name" "test atlanta west", "internalid" "1", "externalid"\ null }, "lastmodifieddate" 1639492139, "itemlist" { "replaceall"\ null, "item" \[ { "unitsdisplay"\ null, "taxrate1" "0 0", "taxcode" { "type"\ null, "name" "vat in\ undef in", "internalid" "5", "externalid"\ null }, "tax1amt" 0 0, "shipmethod"\ null, "shipgroup"\ null, "serialnumbers"\ null, "revrecstartdate"\ null, "revrecschedule"\ null, "revrecenddate"\ null, "rate" "2 00", "quantityremaining"\ null, "quantityreceived"\ null, "quantitybilled"\ null, "quantity" 6 0, "price" { "type"\ null, "name" "base price", "internalid" "1", "externalid"\ null }, "ponum"\ 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" 12 0, "expectedreceiptdate"\ null, "description" " for shooting arrows", "department"\ null, "customfieldlist" { "customfield" \[ { "valuelookup"\ null, "value" "1", "scriptid" "custcol gh line no", "internalid" "175", "fieldtype"\ null }, { "valuelookup"\ null, "value" "false", "scriptid" "custcol checkbox", "internalid" "443", "fieldtype"\ null } ] }, "createpo"\ null, "costestimatetype"\ null, "costestimate"\ null, "classification"\ null, "amount" 12 0 }, { "unitsdisplay"\ null, "taxrate1" "0 0", "taxcode" { "type"\ null, "name" "vat in\ undef in", "internalid" "5", "externalid"\ null }, "tax1amt" 0 0, "shipmethod"\ null, "shipgroup"\ null, "serialnumbers"\ null, "revrecstartdate"\ null, "revrecschedule"\ null, "revrecenddate"\ null, "rate" "9 00", "quantityremaining"\ null, "quantityreceived"\ null, "quantitybilled"\ null, "quantity" 4 0, "price" { "type"\ null, "name" "alternate price 1", "internalid" "2", "externalid"\ null }, "ponum"\ null, "orderline"\ null, "onhand"\ null, "location"\ null, "line" 3, "jobname"\ null, "itemreceive"\ null, "itemname"\ null, "itemisfulfilled"\ null, "item" { "type"\ null, "name" "apple", "internalid" "444", "externalid"\ null }, "grossamt" 36 0, "expectedreceiptdate"\ null, "description" "sales", "department"\ null, "customfieldlist" { "customfield" \[ { "valuelookup"\ null, "value" "2", "scriptid" "custcol gh line no", "internalid" "175", "fieldtype"\ null }, { "valuelookup"\ null, "value" "false", "scriptid" "custcol checkbox", "internalid" "443", "fieldtype"\ null } ] }, "createpo"\ null, "costestimatetype"\ null, "costestimate"\ null, "classification"\ null, "amount" 36 0 } ] }, "internalid" "91404", "handlingcost"\ null, "externalid"\ null, "exchangerate" 1 0, "entity" { "type"\ null, "name" "21 atherton grocery", "internalid" "362", "externalid"\ null }, "duedate" 1601956800, "discounttotal" 0 0, "discountrate"\ null, "discountitem"\ null, "department" { "type"\ null, "name" "pr department", "internalid" "1", "externalid"\ null }, "customform" { "type"\ null, "name" "custom product invoice", "internalid" "104", "externalid"\ null }, "customfieldlist" { "customfield" \[ { "valuelookup" { "type"\ null, "name" "b", "internalid" "2", "externalid"\ null }, "value"\ null, "scriptid" "custbody customlist", "internalid" "458", "fieldtype"\ null }, { "valuelookup"\ null, "value" "true", "scriptid" "custbody checkbox", "internalid" "272", "fieldtype"\ null } ] }, "currencyrecord" { "type"\ null, "name" "us dollars", "internalid" "2", "externalid"\ null }, "currencyname" "us dollars", "createdfrom"\ null, "createddate" 1639488959, "classification" { "type"\ null, "name" "individual partner class", "internalid" "2", "externalid"\ null }, "billingaddress" { "zip"\ null, "state" "tamilnadu", "internalid"\ null, "country" " india", "city" "madurai", "attention"\ null, "addrphone"\ null, "addressee"\ null, "addr3"\ null, "addr2" "bvr street", "addr1" "dno 32 123 23" }, "account" { "type"\ null, "name" "accounts receivable", "internalid" "122", "externalid"\ null } } ] } }