Eric Schultz
03/06/2025, 8:04 PMCeligo AI
03/06/2025, 8:05 PMAI generated answer (using internal Slack threads):To select all rows whose last updated is older than 30 days ago using N/Query, you can use the
TO_DATE
function in your WHERE clause to compare the lastmodifieddate
with the current date minus 30 days. Here is an example:
javascript
require(['N/query'], function(query) {
var sql = "SELECT * FROM transaction WHERE lastmodifieddate <= TO_DATE( CURRENT_DATE - INTERVAL '30' DAY, 'YYYY-MM-DD')";
var result = query.runSuiteQL({query: sql});
result.results.forEach(function(row) {
log.debug({
title: 'Row Data',
details: row
});
});
});
In this example, CURRENT_DATE - INTERVAL '30' DAY
calculates the date 30 days ago from the current date. The TO_DATE
function is used to format this date in the 'YYYY-MM-DD' format that NetSuite requires. The <=
operator is used to select all rows where the lastmodifieddate
is less than or equal to (i.e., older than) this date.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
03/06/2025, 8:05 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794367611
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.793486714
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.7924577
Celigo AI
03/06/2025, 8:05 PM