i ran into issues disabling sublist fields using 2...
# suitescript
c
i ran into issues disabling sublist fields using 2.0 and had to go to 1.0 to disable them. NetSuite support also suggested the same workaround.
e
yep, i’ve had issues as well, especially as it relates to the first line of a sublist that has no lines populated (on create, for example)
b
getSublistField doesn't work when the line is equal to the line count
specifically because it uses a function to try and validate the index
Copy code
function validateAndGetOneBasedIndex(index, method, indexUpperLimit)
	    {
	        if (isNaN(index))
	            return index;
	        else
	            index = parseInt(index, 10);

	        if (index < 0 || (indexUpperLimit !== undefined && index >= indexUpperLimit))
	        {
	            throw error.create({name: error.Type.INVALID_SUBLIST_OPERATION, message: method});
	        }
	        else
	        {
	            return index + 1;
	        }
	    }
in this case, the indexUpperLimit is equal to getV1api().nlapiGetLineItemCount(sublistId)
e
Bug? Has this been shown to NS support?
b
dunno
bugs that have alternatives tend not to get fixed
e
True, true. Though this has no alternative in 2.0, bu which is why we're referring to 1.0 for these operations.
@Mariano Saenz (NS Eng Lead) @Albert Margarit (NS Eng Lead) what do you think about this 2.0 bug?
c
i brought it up to support a while back and they just went with a "thats the way it works sorry" approach
even though its clearly a bug