Hi Guys! I’ve a button on the SO on NetsuiteUI tha...
# suitescript
m
Hi Guys! I’ve a button on the SO on NetsuiteUI that loads the order and removes a line with:
Copy code
record.removeLine({ sublistId: 'item', line: 0 });
The order has two lines, and this code should delete the first one, but for some reason it deletes the second line. Anyone has some inputs on why NS is doing this? Thanks! Note: The script that removes the line is a Client 2.0
b
your description is contradictory, im not sure if your code is running client side or server side
that said, i dont think that really matters unless you are affected by variable shadowing
there basically is only one way to remove lines, using the removeLine method
and your parameters look right for removing the first item line
m
By backend I meant NetSuite UI. sorry about that.
I debugged when the remove line runs and the variable is 0
I’ve just tried loading the record, and removing the line 0 and it does the same, removes the second one 🤔
b
What does all your code look like
m
I just did this on the console
and removed the second line
maybe something wrong with the order? for some reason… idk
b
sounds weird
try it in a serverside code
m
weird indeed!
will do, thanks!
c
Drop the code into a suitelet and run that
👌 1
Also, what type of item is at index 0 on your transaction?
✔️ 1
m
both are inventory items
c
Double check using the chrome extension what is at index 0
or log what is on line 0