Nour Khaled
02/18/2025, 10:25 AMCeligo AI
02/18/2025, 10:25 AMAI generated answer (using internal Slack threads):To create a saved search in SuiteScript 2.0 that given the item internal id and the lot number returns the lot number's internal id, you can use the
N/search
module. Here is a sample code snippet:
javascript
var searchObj = search.create({
type: "inventorynumber",
filters:
[
["internalidnumber","is", itemId],
"AND",
["inventorynumber","is", lotNumber]
],
columns:
[
search.createColumn({name: "internalid", label: "Internal ID"})
]
});
var resultSet = searchObj.run();
var results = resultSet.getRange({start: 0, end: 100});
for (var i = 0; i < results.length; i++) {
var lotInternalId = results[i].getValue({name: 'internalid'});
log.debug('Lot Internal ID', lotInternalId);
}
In this code snippet, itemId
and lotNumber
are the item internal id and the lot number respectively. The search is created on the inventorynumber
record type with filters for the item internal id and the lot number. The internal id of the lot number is then retrieved from 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
02/18/2025, 10:25 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823526323
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823151052
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818953
Celigo AI
02/18/2025, 10:25 AM