Netsuite Suitescript: How to retrieve records based on last modified date?

Viewed 5910

I am trying to retrieve records in Netsuite via SuiteScript. I would like to use the lastmodifieddate column to fetch record after a certain timestamp.

I am currently doing:

var filters = [new nlobjSearchFilter('lastmodifieddate', null, 'notbefore', time)];
var columns = [new nlobjSearchColumn('lastmodifieddate')];
var newSearch = nlapiCreateSearch(table, filters, columns);
var searchResultSet = newSearch.runSearch();
var back = nextEndIndex - 1000
var results = searchResultSet.getResults(back, nextEndIndex);

Where time is a datetime JS, nextEndIndex index counter for results.

This works for some objects but majority of Netsuite objects do not have the lastmodifieddate column in the record browser. Is there a built in variable for the lastmodifieddate? And if there is, how can I use it in nlapiCreateSearch? If you have better ways to do it, I would be grateful for the info.

3 Answers
Related