/* Function to get the onhand quantity of item
* @param {itemID}
* @param {locName}
* @return {searchResultCount}
*/
function fetchItemOnhandQunatity(itemID, locName)
{
var inventoryitemSearchObj = search.create({
type: "inventoryitem",
filters:
[
["type","anyof","InvtPart"],
"AND",
["internalidnumber","equalto",itemID],
"AND",
["inventorylocation.name","is",locName]
],
columns:
[
search.createColumn({
name: "itemid",
sort: search.Sort.ASC,
label: "Name"
}),
search.createColumn({
name: "name",
join: "inventoryLocation",
label: "Name"
}),
search.createColumn({name: "locationquantityonhand", label: "Location On Hand"})
]
});
var searchResultCount = inventoryitemSearchObj.runPaged().count;
return searchResultCount ;
}