SunShine
02/08/2025, 2:12 PMCeligo AI
02/08/2025, 2:12 PMAI generated answer (using internal Slack threads):To get the
quantityavailable
of an inventory item by itemid
and locationid
using SuiteScript 2.0, you can use the N/search
module to create a search. The locationquantityavailable
field is not directly available on the Inventory Item record, but it can be accessed through an Item search.
Here is a sample code snippet:
javascript
require(["N/search"], function (s) {
s.create({
type: s.Type.INVENTORY_ITEM,
filters: [
["internalid", s.Operator.ANYOF, [itemId]], "and",
["inventorylocation", s.Operator.ANYOF, [locationId]], "and",
["locationquantityonhand", s.Operator.ISNOTEMPTY, ""]
],
columns: [
{name: "displayname"},
{name: "locationquantitybackordered"},
{name: "locationquantityonhand"},
{name: "locationquantityonorder"}
]
}).run().getRange({start: 0, end: 10}).forEach(printOrder);
function printOrder(result) {
console.group(result.getValue({name:"displayname"}));
console.log("On Hand: " +
result.getValue({name:"locationquantityonhand"})
);
console.log("On Order: " +
result.getValue({name:"locationquantityonorder"})
);
console.log("Backordered: " +
result.getValue({name:"locationquantitybackordered"})
);
console.groupEnd();
return true;
}
});
In this example, the itemId
and locationId
are the internal IDs of the item and location respectively. The search filters are set to match these IDs. The locationquantityonhand
field is used to get the quantity available at the specified location. The search results are limited to the first 10 records for demonstration purposes.
******
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/08/2025, 2:13 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.857533693
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.851019084
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84839344
Celigo AI
02/08/2025, 2:13 PM