```const line = rec.getCurrentSublistIndex({ subli...
# suitescript
j
Copy code
const line = rec.getCurrentSublistIndex({ sublistId: 'item' });
const max = rec.getLineCount({ sublistId: 'item' });

// if the current line is a new line that has not been commited, then line === max
// and getSublistField throws an error SSS_INVALID_SUBLIST_OPERATION
if (0 <= line && line < max) {
    // safely use rec.getSublistField
}