Saturday, February 9, 2019

Preload Items on Sales Order Using SuiteScript

-The customer has hundreds of inventory items for sale, but most of the sales are concentrated on a few items.
-The customer would like to set up a Sales Order template, which, when it is used to create a new Sales Order with preloaded three items with zero quantities.

The script should be deployed as client side script on record level or on form level to be triggered on pageInit. 


function paageInit() {
nlapiSetCurrentLineItemValue('item', 'item', 5, true, true);
nlapiSelectLineItem('item', 2);
nlapiSetCurrentLineItemValue('item', 'item', 6, true, true);
nlapiSelectLineItem('item', 3);
nlapiSetCurrentLineItemValue('item', 'item', 6, true, true);

The fifth parameter of nlapiSetCurrentLineItemValue should be set as true, which means synchronous mode.

DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.

No comments:

Post a Comment