Netsuite Saved Search to Suitelet Sublist

I am trying to populate a sublist in a suitelet with data from a custom saved search that I have already created. My problem is that the sublist is only populating data from fields that correspond to the "type" of saved search I am doing. For example, in this instance the saved search is a "transaction" type search. If, for example, I want to reference a customer field withing the saved search, say "Name" and "Billing Address", this data will not populate the sublist in the suitelet. All other fields that are being referenced in the Transaction record itself populate the sublist fine. I was just wondering if anyone has ever run into the same issue, anyways here's the code I'm trying to implement.

 var form,

if (request.getMethod() == 'GET')
        //create form
        form = nlapiCreateForm('Test Custom Suitelet Form', false);

        //create sublist to show results
        sublist = form.addSubList('custpage_sublist_id', 'list', 'Item List');

        //form buttons

        // run existing saved search
        var searchResults = nlapiSearchRecord('transaction','customsearchID');
        var columns = searchResults[0].getAllColumns();

        // Add the search column names to the sublist field
        for ( var i=0; i< columns.length; i++ )
                sublist.addField(columns[i].getName() ,'text', columns[i].getLabel() ); 
                nlapiLogExecution('DEBUG', 'Column Label',columns[i].getLabel());

        //additional sublist fields
        sublist.addField('custfield_selected', 'checkbox', 'Selected');






If you review the nlobjSublist docs you'll see that sublist.setLineItemValues can also take an array of hashes. What does work is:

function getJoinedName(col) {
    var join = col.getJoin();
    return join ? col.getName() + '__' + join : col.getName();
searchResults[0].getAllColumns().forEach(function(col) {
    sublist.addField(getJoinedName(col), 'text', col.getLabel());
    nlapiLogExecution('DEBUG', 'Column Label', col.getLabel());
var resolvedJoins = {
    var ret = {
        id: sr.getId()
    sr.getAllColumns().forEach(function(col) {
        ret[getJoinedName(col)] = sr.getText(col) || sr.getValue(col);
    return ret;


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.