Prevent error “You cannot edit the end of group line. You must delete the group.” when setting the Description of Line Items in a Transaction

function userEventBeforeSubmit(type, form, request) {‌
    var lineCount = nlapiGetLineItemCount('item');
    for (var i = 1; i <= lineCount; i++) {‌
        if (nlapiGetLineItemValue('item', 'itemtype', i) != 'EndGroup') {‌
            nlapiSetLineItemValue('item', 'description', i, 'Test_Description');
        }
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *