Function to search for the list of items with no sales description

/**
* Function to list the inventory items with no Sales Description
* @return [itemArray]
*/
function itemSearch()
 {
    let itemArray = [];
    let inventoryitemSearchObj = search.create({
        type: "inventoryitem",
        filters:
        [
           ["type","anyof","InvtPart"],
           "AND",
           ["formulatext: {salesdescription}","isempty",""]
           ],
        columns:
           [
              search.createColumn({ name: "itemid", label: "Name" }),
              search.createColumn({name: "salesdescription", label: "Description"})
           ]
    });
    inventoryitemSearchObj.run().each(function(result)
    {
        let itemObj = {};
        itemObj.itemID = result.getValue({ name: "itemid", label: "Internal ID" });
        itemObj.salesDescription = result.getValue({
                                        name: "salesdescription", 
                                        label: "Description" });
        itemArray.push(itemObj);
    });
    return itemArray ;
}

Leave a comment

Your email address will not be published. Required fields are marked *