Example .ss File Code that Accesses a NetSuite Record

Note:

For more information on SuiteScript 1.0, see SuiteScript 1.0 Guide.

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);
} 

        
Important:

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.

Related Topics

Sample_Cart.ssp
Cart_WithService.ssp
UpdateQuantity.ss
AddCartItem.ss
AddCustomerAddress.ss
ItemOption.ss
Known Issue with Internet Explorer and Plain Text Content
Sample SSP Application Code (SuiteScript 1.0)
SuiteScript 1.0 SSP Applications
Create and Use SSP Applications

General Notices