This mass update script only works on the first li...
# suitescript
r
This mass update script only works on the first line of the project assignee sublist in the project task record. How do you get it to cycle through all lines?
c
Is this meant to be a
1
or an
i
?
r
I didn't create the code, but it's written as a 1. Should it be an 'i'?
c
I believe so - it appears that 3 parameter is for the line number, so if that's set to
1
every time the for loop executes, it'll just overwrite the value in line 1 as many times as there are lines. Setting it to
i
would set the value for each lines as the loop progresses.
r
Didn't work.😑
c
@rudler I've never used SS1, so I'm not familiar with those methods and whether there are any quirks; that said, it looks pretty straightforward. Maybe log a few values, such as
lines
, to make sure the script is attempting to set the correct number of lines.
e
There's no context on what this script is supposed to do, so I can only comment on the code and not the business logic. The first line number is 1 in SS1 and not 0. So, if you just replace the 1 with "i", it's going to start at line 0. Trying changing your "var i=0" to "var i=1" instead. I think you'll need to change your less than to less than or equal to as well.
netsuite halo 1
r
Your recommendations worked: for (var i = 1; i <= lines; i++) { recProject.setLineItemValue('assignee', 'serviceitem', i, serviceItemId); I can now change service item on all lines. Thank you both.
🙌 1