acuestajohnmark
05/08/2025, 7:46 PMCeligo AI
05/08/2025, 7:46 PMAI generated answer (using internal Slack threads):It seems like you're experiencing an issue with the
standardLines.getLine
method in a for loop, where it only returns the zero indexed line. However, when you try to access it by a static line number, it gives the specific data for that line.
This behavior could be due to the way the selectLine
method works in SuiteScript. When you use selectLine
in a loop, it doesn't automatically advance to the next line after a commitLine
operation. Instead, it stays on the current line until you explicitly tell it to move to the next line. This is why you're always getting the zero indexed line in your loop.
When you use a hardcoded line number, selectLine
is able to select that specific line because you're explicitly telling it which line to select.
Here's a potential solution: After each commitLine
operation, you could use the selectNewLine
method to move to the next line. Here's an example:
javascript
for (var i = 0; i < totalItemsCount; i++) {
currentRecord.selectLine({ sublistId: 'item', line: i });
// Perform your operations here...
currentRecord.commitLine({ sublistId: 'item' });
if (i < totalItemsCount - 1) {
currentRecord.selectNewLine({ sublistId: 'item' });
}
}
This code will select each line in the sublist, perform the necessary operations, commit the line, and then move to the next line (if there is one).
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
05/08/2025, 7:46 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.809128284
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807015657
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.805000782
Celigo AI
05/08/2025, 7:46 PMacuestajohnmark
05/08/2025, 7:54 PMCeligo AI
05/08/2025, 7:54 PM