Luis
10/09/2024, 2:18 PMCeligo AI
10/09/2024, 2:19 PMAI generated answer (using internal Slack threads):To add a criteria to a search in SuiteScript that searches records with datecreated in the last 24 hours, you can use a Formula (Numeric) criteria filter. Set the Formula to
{today} - {createddate}
which returns the number of days elapsed as a floating point value, then filter on results less than or equal to
value 1
. This will give you the records created in the last 24 hours.
Here is a sample code snippet:
javascript
var search = require('N/search');
var mySearch = search.create({
type: "salesorder",
filters:
[
["formulanumeric: {today} - {createddate}", "lessthanorequalto", 1]
]
});
This code creates a search for sales orders that were created in the last 24 hours. The filter uses a formula to calculate the difference between the current date and the created date of the sales order. If the difference is less than or equal to 1 (i.e., the sales order was created within the last 24 hours), the sales order is included in the search results.
******
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
10/09/2024, 2:19 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845420301
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829418063
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822995663
Celigo AI
10/09/2024, 2:19 PM