Mandatory Filters to be added while updating an IF Record

//Info: HL-139

There are chances to have multiple Item Fulfillment records with the same internal id but hold some values differently.
In order to make it more clear, it’s better to add these filters to the search criteria.

var itemfulfillmentSearchObj = search.create({
                    type: "itemfulfillment",
                    filters:
                        [
                            ["numbertext", "is", docnumber],
                            "AND",
                            ["type", "anyof", "ItemShip"],
                            "AND",
                            ["shipping", "is", "F"],
                            "AND",
                            ["mainline", "is", "T"],
                            "AND",
                            ["taxline", "is", "F"],
                            "AND",
                            ["cogs", "is", "F"]
                        ],
                    columns:
                        [
                            search.createColumn({name: "internalid", label: "Internal ID"})
                        ]
                });
                var searchResultCount = itemfulfillmentSearchObj.runPaged().count;

                if (searchResultCount < 1) {
                    log.debug("Document Number " + docnumber, " is not found")
                    return false;

                }

                var searchResult = itemfulfillmentSearchObj.run().getRange({
                    start: 0,
                    end: 1000
                });

Leave a comment

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