```if (item) { currentRecord.selectNewLine({ ...
# suitescript
m
Copy code
if (item) {
    currentRecord.selectNewLine({
        sublistId: 'item'
    });
    currentRecord.setCurrentSublistValue({
        sublistId: 'item',
        fieldId: 'item',
        value: item,
        forceSyncSourcing: true
    });
    currentRecord.commitLine({
        sublistId: "item"
    });

    //Set Description
    var count = currentRecord.getLineCount({
        sublistId: 'item'
    });
    alert(count);
    for (var j = 0; j < count; j++) {
        alert("Inside Loop");
        currentRecord.selectLine({
            sublistId: 'item',
            line: j
        });
        currentRecord.setValue({
            sublistId: 'item',
            fieldId: 'description',
            value: "TEST",
        });
    }
}
Before the //set description - I am able to set an item group. The item group has several other items which gets added to the line. I would like to add a description to each line but I haven't managed to do that. I figured I would try to allow the group item set all the lines, then loop over them and set the field. I noticed that the alert kicks off before the lines are added.