Hey all. I know suitescript 2.0 but I don't have m...
# suitescript
a
Hey all. I know suitescript 2.0 but I don't have much experience using 1.0 I have to fix an old script written in 1.0 I want to dynamically create a salesorder, enter a customer(entity), enter an item in the item sublist and get the rate of that line. I don't need to save the record. (I know it sounds like a backward way of doing things, but for reasons that are hard to explain, thats what I need to do) In the debugger this is a working 2.0 script
Copy code
require(['N/record', 'N/search'],
                function (record, search) {

                    var rec = record.create({
                        type: record.Type.SALES_ORDER,
                        isDynamic: true,
                        defaultValues: {
                            entity: 1707657
                        }
                    })         
    
                        rec.selectNewLine({
                            sublistId: 'item'
                        });
                        rec.setCurrentSublistValue({
                            sublistId: 'item',
                            fieldId: 'item',
                            value: 94230
                        });
                        var sublistValue = rec.getCurrentSublistValue({
                            sublistId: 'item',
                            fieldId: 'rate'
                        });

                    var stopper = 0
                })
I went to the conversion chart in the help center, and this should be the equivalent 1.0 code, but this doesn't work in the debugger.
Copy code
var initvalues = new Array();
            initvalues.recordmode = 'dynamic';
            initvalues.entity = 1707657;

            // create sales order and pass values stored in the initvalues array
            var rec = nlapiCreateRecord('salesorder', initvalues);

            nlapiSelectNewLineItem('item')
            nlapiSetCurrentLineItemValue('item', 'item', 94230)  
            var sublistValue = nlapiGetCurrentLineItemValue('item', 'rate')

var stopper = 0
Any ideas where I may be going wrong?