id like to create a search that filters items base...
# ask-stanley-ai
c
id like to create a search that filters items based upon the inventory location reorder point
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To create a search that filters items based on the inventory location reorder point, you can use the SuiteScript
search.create
method. Here is a sample code snippet that you can modify to suit your needs:
Copy code
javascript
var itemSearchObj = search.create({
   type: "item",
   filters:
   [
      ["locationquantityavailable","greaterthan","0"],
      "AND",
      ["name","is","item"],
      "AND",
      ["inventorylocation.isinactive","is","F"]
   ],
   columns:
   [
      search.createColumn({
         name: "itemid",
         sort: search.Sort.ASC,
         label: "Name"
      }),
      search.createColumn({name: "inventorylocation", label: "Inventory Location"}),
      search.createColumn({name: "locationquantityavailable", label: "Location Available"})
   ]
});
var searchResultCount = itemSearchObj.runPaged().count;
log.debug("itemSearchObj result count",searchResultCount);
itemSearchObj.run().each(function(result){
   // .run().each has a limit of 4,000 results
   return true;
});
This script creates a search on the item record, filtering for items where the location quantity available is greater than 0, the item name is "item", and the inventory location is active. The search returns the item ID, inventory location, and location quantity available. Please note that you may need to adjust the filters and columns to match your specific requirements. For example, you might want to replace
"locationquantityavailable","greaterthan","0"
with
"locationreorderpoint","lessthan","desired reorder point"
to filter based on the inventory location reorder point.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84576416
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841369689
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.840149045
Please provide your feedback on this answer.