SuiteScript 1.0 runSearch always returns null

272 Views Asked by At

I am trying to create a scheduled script that loads a load of Tasks based on a joint record. The field is a checkbox but when I put 'T' or 'F' it returns null results.

function runScheduledScript() {
    const mytasks = getAllTasksWhereTheAssetCoordinatesHaveChanged();
    nlapiLogExecution('debug', "Tasks", JSON.stringify(mytasks));
}

/**
 * Creates A Search To Find All Tasks where its asset coords have changed
 * @returns  {Object}   Returns the a nlobjSearchResultSet with all Tasks where its asset coords have changed
 */
function getAllTasksWhereTheAssetCoordinatesHaveChanged() {

    // Create Filters
    const myfilters = new Array();
    myfilters[0] = new nlobjSearchFilter("custrecord_nxc_asset_coord_have_changed", 'custevent_nx_task_asset', 'is', 'T');
    
    // Create Search, No Columns Are Needed
    const searchObj = nlapiCreateSearch('task', myfilters, new Array());
    
    // Return The Search Results
    return searchObj.runSearch();
}
1

There are 1 best solutions below

0
On

Unfortunately, I don't have the answer to your question, but I recommend you use the NetSuite: Search Export extension. It's really useful!