Today I wanted to create first 2.0 Suitelet, but I couldn't find any simple and easy way to get sublist data from sublist which was created as a part of Suitelet form. Of course you have context.request.parameters.sublistdata where all the data are stored after page submit, but you need to manually split it. I thought that maybe I'm missing something, but actually this is the part of an example from Netsuite help:
var delimiter = /\u0001/;
var textField = context.request.parameters.textfield;
var dateField = context.request.parameters.datefield;
var currencyField = context.request.parameters.currencyfield;
var selectField = context.request.parameters.selectfield;
var sublistData = context.request.parameters.sublistdata.split(delimiter);
var sublistField1 = sublistData[0];
var sublistField2 = sublistData[1];
which means that actually splitting is the correct way (Netsuite example is for getting only first 2 fields of first row. If you have more rows you need to split it by /\u0002 to get rows and then each row by /\u0001/ to get fields.
If you consider the fact that in SuiteScript 1.0 you have nlobjRequest which has getLineItemCount(group) and getLineItemValue(group, name, line) and in 2.0 you need to split the data to extract it from 1 huge string, it's just step backwards. I was hoping that either context.request.parameters.sublistdata will have array of row objects, or there will be some method to get sublist data as JSON object.
Am I missing something? Is there any other (better) way of getting sublist data from suitelet form?