Remove-BomWindowEntity

Removes an entity from the BOM Window.

Syntax

1
Remove-BomWindowEntity [[-InputObject] <PSObject>] [<CommonParameters>]

Parameters

Type

Name

Description

Optional

BomRow / Item

InputObject

An entity displayed in the BOM Window. The argument accepts pipeline input

no

Return type

empty ← On failure the Exception/ErrorMessage can be accessed using $Error.

Remarks

The Cmdlets’s purpose is to remove a BomRow or an Item from the BOM Window.
When removing a BomRow, the row and the associated Item will be removed together!
The same applies when removing an Item that depends on a BomRow: the item and the associated BomRow will be removed at the same time.

Restrictions:

  • Items that are used in multiple BOM’s can not be removed

  • Only BomRows without any children can be removed

Examples

Removing an item from the BOM Window:

1
$item | Remove-BomWindowEntity

Removing rows from a BOM:

1
2
3
foreach($bomRow in $bom.Children) {
        $bomRow | Remove-BomWindowEntity
}

Deletes an item when marked as “Remove” and when successfully deleted in ERP:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
function Transfer-Items($items) {
        foreach($item in $items) {
                if($item._Status -eq 'Remove'){
                        $removed = Remove-ERPObject -EntitySet 'Materials' -Keys @{'Number'=$item._PartNumber}
                        if($removed) {
                                $item | Remove-BomWindowEntity
                        }
                }
        }
}