Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
How do you create a search filter for a date time filter like Last Modified Date in SuiteScript 2.0?
How do you create a search filter for a date time filter like Last Modified Date in SuiteScript 2.0?
require(["N/search", "N/format"], function (search, format) { search .create({ type: search.Type.TRANSACTION, filters: [ { name: "lastmodifieddate", operator: search.Operator.WITHIN, values: [ new Date("2020-03-27T07:00:00.000Z"), new Date("2020-03-27T19:00:00.000Z"), ], }, ], }) .run() .getRange({ start: 0, end: 1000 });});The above throws an error that looks like:
{ "type": "error.SuiteScriptError", "name": "INVALID_DATE_VALUE_1_MUST_MATCH_2", "message": "Invalid date value Fri Mar 27 2020 12:00:00 GMT-0700 (PDT) (must match MM/dd/yy H:mm)", "stack": [ "createError(N/error.js)", "<anonymous>(adhoc$-1$debugger.user:17)", "<anonymous>(adhoc$-1$debugger.user:1)" ], "cause": { "type": "internal error", "code": "INVALID_DATE_VALUE_1_MUST_MATCH_2", "details": "Invalid date value Fri Mar 27 2020 12:00:00 GMT-0700 (PDT) (must match MM/dd/yy H:mm)", "userEvent": null, "stackTrace": [ "createError(N/error.js)", "<anonymous>(adhoc$-1$debugger.user:17)", "<anonymous>(adhoc$-1$debugger.user:1)" ], "notifyOff": false }, "id": "", "notifyOff": false, "userFacing": false} 1