I’m testing some code in the browser console. If ...
# suitescript
j
I’m testing some code in the browser console. If I try to run the following all in one step, it’s as if the last line (the
commitLine()
) does not execute. If I separate it out, doing all but the last line, press enter, then the last line, press enter in the browser console, it works. I need to be able to add multiple lines in one client script. Any thoughts on what I am doing wrong here?
Copy code
var tx = currentRecord.get();

tx.selectNewLine({sublistId: 'item'});
tx.setCurrentSublistValue({sublistId: 'item', fieldId: 'item', value: 30});
tx.setCurrentSublistValue({sublistId: 'item', fieldId: 'amount', value: 100, ignoreFieldChange: true});
tx.setCurrentSublistValue({sublistId: 'item', fieldId: 'taxcode', value: 4, ignoreFieldChange: true});
tx.commitLine({sublistId: 'item'});
b
you probably want to be very weary of ignoreFieldChange on a sourced field like taxcode, netsuite also internally uses field changes
j
weary wary
This is just a dummy example, I’m actually setting a crapton of columns including item options
there’s other math I don’t want to have run that would usually be triggered. I’ll be tweaking which columns need to trigger Fchange
bitchin’, this works, thanks @battk
well it kinda works. I’m actually trying to add a list of things, some of which are in an item group, but I want to control what is in the group in the client script. Thought I could follow this guide but I think I’ll have to manually remove the items added by the group now: https://followingnetsuite.com/2020/04/01/suitescript-item-groups/