Example .ss File Code that Accesses a NetSuite Record

This topic applies to

Applies to

SuiteCommerce | SuiteCommerce Advanced | Site Builder


Code like the following can be used in an .ss file to access a NetSuite record rather than a shopping session object.

function service(request,response) { var salesOrder = nlapiCreateRecord('salesorder', true); salesOrder.setFieldValue('customform', 88); // Cash Sale form. salesOrder.setFieldValue('orderstatus', 'B'); salesOrder.selectNewLineItem('item'); salesOrder.setCurrentLineItemValue('item', 'item', 6); salesOrder.setCurrentLineItemValue('item', 'quantity', 1); salesOrder.setCurrentLineItemValue('item', 'rate', 500); salesOrder.commitLineItem('item'); nlapiSubmitRecord(salesOrder); }


Running an .ss file with code accessing a NetSuite record requires a preexisting NetSuite session. Running this code without first logging in to NetSuite results in permission errors. Running this type of code from the shopping domain also results permission errors, because shoppers are only recognized in the shopping domain.