Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

NetSuite Add Line Item to a Sales Order in afterSubmit

function afterSubmit(type)
{
    if(type == 'create' || type == 'edit')
    {
        var record = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId()); //Load the record

        //Loop to all sublist item
        var count = record.getLineItemCount('item');
        for(var i = 1; i <= count; i++)
        {
            var item = record.getLineItemValue('item', 'item', i); //This will return the internal id of the item
            if(item == 100) //Item is equal to 100; insert one item
            {
                record.insertLineItem('item', i);
                record.setLineItemValue('item', 'item', i, 200); //Repair Cost internal id
                record.setLineItemValue('item', 'quantity', i, 1); //You should put some quantity; depending on your account setup all required fields should be set here.
            }
        }

        //Submit the changes
        nlapiSubmitRecord(record, true);
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to make a discord js bot get its own message id 
Javascript :: cancellable function 
Javascript :: Pause interval button javascript 
Javascript :: e.addEventListener("input", function(){ e.value?n.innerText="Nama: "+e.value:n.innerText=""; }); 
Javascript :: Get value from ionRangeSlider in jquery 
Javascript :: make python editor with code codemirror javascript 
Javascript :: jaavascript loop array 
Javascript :: how to convert base64 to webp in angular 
Javascript :: botão delete no reactjs com class component 
Javascript :: paypal react native 
Javascript :: discord js send author a dm 
Javascript :: convert componentWillUnmount into useEffect 
Javascript :: react router dom link same page with different param 
Javascript :: indonesia whatsapp formatter javascript 
Javascript :: vue router accept params null 
Javascript :: Immediate execution of a function 
Javascript :: javascript map shorthand 
Javascript :: disable button without losing value 
Javascript :: Nested comparison operator in Javascript 
Javascript :: how to send a message to email in js using window.open 
Javascript :: Search products from an array by keywords in javascript 
Javascript :: play 2 audio react 
Javascript :: id generator using javascript 
Javascript :: how to connect terminal with javascript 
Javascript :: get gravatar javascript 
Javascript :: multiple question node js 
Javascript :: javascript centuries 
Javascript :: The app structure generator Express 
Javascript :: express plus es6 
Javascript :: Node-Red: Bit Switch 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =