Check-Items

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.

Syntax

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

Parameters

Type

Name

Description

input/output

Mandatory

Default value

Item []

Items

The Items which should be checked

input

yes

Return type

void

Remarks

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.

Examples

Marking all items that exist on ERP with Status and StatusDetails “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' -StatusDetails 'Item exists in ERP'
         }else{
           $item | Update-BomWindowEntity -Status 'New' -StatusDetails 'Item does not exist in ERP'
         }
     }
}