Record.setSublistValue() Errors and Fixes


Here are some common errors that can cause while using Record.setSublistValue() function. If not handled these errors can stop the sublist values from rendering on the NetSuite suitelet page.

  1. INVALID_FLD_VALUE error
    This error can happen if the value is passed as the value parameter in the Record.setSublistValue() function. The type should match the value passed.
    e.g:
    form.subLists.custpage_sublist1.addField({
    id: sublist_id,
    label: 'Sublist',
    type: serverWidget.FieldType.TEXT,
    align: serverWidget.LayoutJustification.CENTER,
    });

    Fix: Here the value should be always of ‘text’ type(string).
  2. EXCEEDED_MAX_FIELD_LENGTH error
    This error happens when the value exceeds the field length limit. For example, in the previous sublist code, if the value given is a string greater than 300 characters it can cause this error.
    Fix: Limit the size of the string using ‘substring()’ or similar function.
    form.subLists.custpage_sublist1.setSublistValue({
    id: sublist_id,
    line: index,
    value: (sublistStringValue).substring(0,300)
    });

Leave a comment

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