This function is executed when clicking the “Check” button within the Item Tab.
All the Items from the BOM Window can be checked against ERP.

Check-Items [-Items] <Item[]>

TypeNameDescriptioninput/outputMandatoryDefault value
Item[]ItemsThe items which should be checked.inputYes


Each unique Item shown in the BOM Window will be passed to this function.

It's recommended to update the Status of all the Items with the Update-BomWindowEntity cmdlet.

When an exception is thrown within this function, the BOM Window shows the Exception message of the terminated Check operation.
The Status of all the Items that where not updated, gets automatically changed to Unknown.

Marking all items that exist on ERP with State and Tooltip “Identical”, otherwise as “New”:

function Check-Items($items) {
    foreach($item in $items) {
		$erp_material = Get-ERPObject -EntitySet 'Materials' -Keys @{'Number' = $item._PartNumber} -Expand "Descriptions"
		if($erp_material) {
                        $item | Update-BomWindowEntity -Status 'Identical' -ToolTip 'Item exists in ERP'
			$item | Update-BomWindowEntity -Status 'New' -ToolTip 'Item does not exist in ERP'