Global API
...
Requests
Invoice
Create
1min
to create an invoice in netsuite, use action as "createinvoice" and pass the invoice data in the requestjson under "invoices" note you can only create one record at a time the following is an example of creating an invoice, where we are setting every possible field (see https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/hnjmkn99qxwdeafyyifsq https //app archbee io/docs/ lihuunv 7xnqrtzhskkc/emqjiknclze b zi9pinn for invoice docid\ xsrer45ur9lxkfahmkbrh the available fields) the response will return the response back from netsuite, which includes the new netsuite invoice id (internalid), plus the newly created salesforce invoice id (salesforceid) request //create a map to store all the data of a invoice map\<string, object> nsinvoice = new map\<string, object>(); nsinvoice put('classification', new map\<string, object>{'internalid'=>'5'}); nsinvoice put('currencyrecord', new map\<string, object>{'internalid'=>'2'}); nsinvoice put('department', new map\<string, object>{'internalid'=>'2'}); nsinvoice put('entity', new map\<string, object>{'internalid'=>'362'}); 	nsinvoice put('location',new map\<string, object>{'internalid'=>'1'}); 	nsinvoice put('memo', 'invoice 100'); nsinvoice put('otherrefnum', '4343399'); nsinvoice put('trandate', datetime newinstance(2020, 09, 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', 'select'); invcustomfield put('scriptid', 'custbody customlist'); invcustomfield put('valuelookup', new map\<string,object>{'internalid'=>'2'}); 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', 'a weapon for shooting arrows'); lineitem put('item', new map\<string, object>{'internalid'=>'239'}); lineitem put('quantity', 3); // 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 invoice line item custom fields lineitem put('customfieldlist', new map\<string, object>{'customfield'=>licustomfieldlist}); lineitemlist add(lineitem); // adding the line items to invoice map\<string, object> invlineitemlist = new map\<string, object>(); invlineitemlist put('item', lineitemlist); 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', 'createinvoice'); 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=createinvoice, timestamp=1639471468356, validrequest=true, version=1 0, responsejson={ "errors" \[], "status" "200", "invoices" \[ { "undepfunds"\ null, "tranid" "inv429", "trandate" 1599364800, "total" 6 0, "terms"\ null, "taxtotal" 0 0, "subtotal" 6 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" "a0b0l00000aveodea3", "otherrefnum" "4343399", "nullfieldlist"\ null, "memo" "invoice 100", "location" { "type"\ null, "name" "test atlanta west", "internalid" "1", "externalid"\ null }, "lastmodifieddate" 1639471436, "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" 3 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" 6 0, "expectedreceiptdate"\ null, "description" "a weapon for shooting arrows", "department"\ null, "customfieldlist" { "customfield" \[ { "valuelookup"\ null, "value" "true", "scriptid" "custcol checkbox", "internalid" "443", "fieldtype"\ null } ] }, "createpo"\ null, "costestimatetype"\ null, "costestimate"\ null, "classification"\ null, "amount" 6 0 } ] }, "internalid" "91303", "handlingcost"\ null, "externalid"\ null, "exchangerate" 1 0, "entity" { "type"\ null, "name" "21 atherton grocery", "internalid" "362", "externalid"\ null }, "duedate" 1599364800, "discounttotal" 0 0, "discountrate"\ null, "discountitem"\ null, "department" { "type"\ null, "name" "sales", "internalid" "2", "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" "false", "scriptid" "custbody checkbox", "internalid" "272", "fieldtype"\ null } ] }, "currencyrecord" { "type"\ null, "name" "us dollars", "internalid" "2", "externalid"\ null }, "currencyname" "us dollars", "createdfrom"\ null, "createddate" 1639471436, "classification" { "type"\ null, "name" "corporate sales", "internalid" "5", "externalid"\ null }, "billingaddress" { "zip" "94567", "state" "ca", "internalid"\ null, "country" " unitedstates", "city" "pope valley", "attention"\ null, "addrphone"\ null, "addressee"\ null, "addr3"\ null, "addr2" "palo alto", "addr1"\ null }, "account" { "type"\ null, "name" "accounts receivable", "internalid" "122", "externalid"\ null } } ] } }