Global API
...
Requests
Item
Create
1min
the following is an example of creating an item where we are setting every possible field (see item docid\ uwajnf0exxeygtmse4uve for the available fields) the response will return the exact request data plus the new netsuite item id (internalid) and the newly created salesforce item id (salesforceid) pass skipdml as true in the request to skip the dml operation in salesforce request // create a map to store all the data of an item 1 map\<string, object> nsitem1 = new map\<string, object>(); nsitem1 put('itemtype', 'noninventoryresaleitem'); nsitem1 put('itemid', 'leather jacket'); nsitem1 put('taxschedule', new map\<string, object>{'internalid'=>'1'}); nsitem1 put('incomeaccount', new map\<string, object>{'internalid'=>'54'}); nsitem1 put('expenseaccount', new map\<string, object>{'internalid'=>'58'}); nsitem1 put('salesdescription', 'blue color leather jacket'); nsitem1 put('upccode', '00123456789012'); // provide the subsidiary list list\<object> subsidiarylist1 = new list\<object>{new map\<string, object>{'internalid'=>'1'}}; nsitem1 put('subsidiarylist', new map\<string, object>{'recordref'=>subsidiarylist1}); nsitem1 put('includechildren', true); // initializing the item custom fields list\<object> itemcustomfieldlist = new list\<object>(); map\<string, object> itemcustomfield = new map\<string, object>(); itemcustomfield put('fieldtype', 'select'); itemcustomfield put('scriptid', 'custitem standardlist'); itemcustomfield put('valuelookup', new map\<string, object>{'internalid'=>'2'}); itemcustomfieldlist add(itemcustomfield); map\<string, object> itemcustomfield1 = new map\<string, object>(); itemcustomfield1 put('fieldtype', 'boolean'); itemcustomfield1 put('scriptid', 'custitem checkbox'); itemcustomfield1 put('value','true'); itemcustomfieldlist add(itemcustomfield1); // adding the item custom fields nsitem1 put('customfieldlist', new map\<string, object>{'customfield'=>itemcustomfieldlist}); // create a map to store all the data of an item 2 map\<string, object> nsitem2 = new map\<string, object>(); nsitem2 put('itemtype', 'noninventorysaleitem'); nsitem2 put('itemid', 'laptop'); nsitem2 put('taxschedule', new map\<string, object>{'internalid'=>'1'}); // provide the subsidiary list list\<object> subsidiarylist2 = new list\<object>{new map\<string, object>{'internalid'=>'1'}}; nsitem2 put('subsidiarylist', new map\<string, object>{'recordref'=>subsidiarylist2}); // initializing the requestjson data to be passed map\<string, object> requestjsonmap = new map\<string, object>(); requestjsonmap put('items', new list\<object>{nsitem1, nsitem2}); // similarly we can upto 20 items to the list string reqjson = json serialize(requestjsonmap); map\<string, object> reqobj = new map\<string, object>(); reqobj put('version', '1 0'); reqobj put('action', 'createitem'); reqobj put('skipdml', false); 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=createitem, timestamp=1606829457729, validrequest=true, version=1 0, responsejson={ "status" "200", "errors" \[], "items" \[ { "usemarginalrates" false, "unitstype" null, "taxschedule" { "name" "default tax schedule", "internalid" "1" }, "subsidiarylist" { "recordref" \[ { "type" null, "name" "parent company", "internalid" "1", "externalid" null } ] }, "shippingcost" null, "salesforceid" "a082w0000072u8haae", "salesdescription" "blue color leather jacket", "rate" null, "quantitypricingschedule" null, "purchasedescription" null, "pricingmatrix" null, "pricinggroup" null, "preferredlocation" null, "parent" null, "overallquantitypricingtype" " bylinequantity", "minimumquantity" null, "memberlist" null, "maximumquantity" null, "matrixtype" null, "locationslist" null, "location" null, "lastmodifieddate" 1606829455, "itemtype" "noninventoryresaleitem", "itemid" "leather jacket", "isinactive" false, "internalid" "7718", "incomeaccount" { "type" null, "name" "sales", "internalid" "54", "externalid" null }, "includechildren" true, "handlingcost" null, "externalid" null, "expenseaccount" { "type" null, "name" "expenses", "internalid" "58", "externalid" null }, "displayname" null, "description" null, "department" null, "customform" { "type" null, "name" "custom non inventory part form", "internalid" "5", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" { "type" null, "name" "retailer", "internalid" "2", "externalid" null }, "value" null, "scriptid" "custitem standardlist", "internalid" "457", "fieldtype" null }, { "valuelookup" null, "value" "true", "scriptid" "custitem checkbox", "internalid" "250", "fieldtype" null } ] }, "currencyvalue" "1", "createddate" 1606829455, "cost" null, "cogsaccount" null, "classification" null, "assetaccount" null, "account" null }, { "usemarginalrates" false, "unitstype" null, "taxschedule" { "name" "default tax schedule", "internalid" "1" }, "subsidiarylist" { "recordref" \[ { "type" null, "name" "parent company", "internalid" "1", "externalid" null } ] }, "shippingcost" null, "salesforceid" "a082w0000072u8iaae", "salesdescription" null, "rate" null, "quantitypricingschedule" null, "purchasedescription" null, "pricingmatrix" null, "pricinggroup" null, "preferredlocation" null, "parent" null, "overallquantitypricingtype" " bylinequantity", "minimumquantity" null, "memberlist" null, "maximumquantity" null, "matrixtype" null, "locationslist" null, "location" null, "lastmodifieddate" 1606829456, "itemtype" "noninventorysaleitem", "itemid" "laptop", "isinactive" false, "internalid" "7719", "incomeaccount" { "type" null, "name" "sales", "internalid" "54", "externalid" null }, "includechildren" false, "handlingcost" null, "externalid" null, "expenseaccount" null, "displayname" null, "description" null, "department" null, "customform" { "type" null, "name" "custom non inventory part form", "internalid" "5", "externalid" null }, "customfieldlist" { "customfield" \[ { "valuelookup" null, "value" "false", "scriptid" "custitem checkbox", "internalid" "250", "fieldtype" null } ] }, "currencyvalue" null, "createddate" 1606829456, "cost" null, "cogsaccount" null, "classification" null, "assetaccount" null, "account" null } ] } }