I have a Suitelet and a select field. There is a s...
# suitescript
n
I have a Suitelet and a select field. There is a sublist of customers on the suitelet. When i do a fieldChange on the select field and then try to remove the sublist lines and repopulate it with the one record nothing happens. I get the correct line count so not sure.
Copy code
const linecount = context.currentRecord.getLineCount({
              sublistId: 'custpage_ar_sublist'
            });

            for (var i = 0; i < linecount; i++) {
              context.currentRecord.removeLine({
                sublistId: 'custpage_ar_sublist',
                line: i
              });
            }
n
You'll have to reload the page with new filters to populate your suitelet. The sublist is generated serverside when the suitelet loads, then displays to the client. So the client side doesn't have access to add or remove lines
Which is annoying because you can edit field values in the sublist lines client side. Just not remove the line
n
yeah, i agree. Was hoping I could get around reloading haha. thanks @Nathan L
🫡 1
r
It will depend upon the sublist type. Try with different sublist types. Out of 4 sublist types, 2 of them can be populated using client scripts. And you can remove the lines through client script as well. Secondly for removing lines from the sublist always remove from end till start, it will be easier and you will not run in any complications.
b
removing lines from the start to the end is a classic mistake
🙌 1
it changes the indexes while you are iterating through it