Update-BomWindowEntity

Updates an entity in the BOM Window.

Syntax

1
Update-BomWindowEntity [[-InputObject] <PSObject>] [[-Status] <Status>] [[-StatusDetails] <string>] [[-Properties] <Object>] [<CommonParameters>]

Parameters

Type

Name

Description

Optional

BOM / BomRow / Item

InputObject

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

no

Status

Status

The new Status of the entity

yes

String

StatusDetails

The new Status Details of the entity

yes

Hashtable / PSObject

Properties

The properties to add or update for the entity

yes

Return type

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

Remarks

The Cmdlet’s purpose is to update the Properties, Status and StatusDetails of Bom, BomRow and Item in the BOM Window:

Status and StatusDetails:
When updating the Status the according custom StatusDetails is reset when no -StatusDetails is specified. However, the tooltip of the Status Icon will hold a default value.
Additionally, when updating the Status of an entity, the progress in the BOM Window will be automatically incremented for that entity.

Properties:
It is possible to pass new Properties, update existing ones or remove them from the entity as required.

BomRow:
In general two categories of Properties can be provided for BomRows:

  • BOM properties are properties prefixed with Bom (e.g. @{'Bom_Number'= ..., 'Bom_Quantity'= ..., 'Bom_PositionNumber'= ...}). They are displayed only in the BOM-Tab without the prefix.

  • Entity properties are all other properties (e.g. @{'_Name'= ...}). They are displayed in both the BOM-Tab and the Items-Tab.

Custom BOM properties (e.g. @{'Bom_Unit'= ;'Bom_ItemQuantity'= …}) and Entity properties (e.g. @{'Description'= ; 'Title (Item,CO)'= …}) can be passed and later displayed as columns in the BOM Window.
They are replacing the current set of BomRow properties or the ones of the associated Item.

Material:

  • The standard property @{'_Name'= ...} can be passed in order to update the item number if required.

  • Other properties are replacing the current set of custom properties for instance @{'Description'= ; '_Title(Item,CO)'= …}.

Examples

Updating the Status and StatusDetails of a BOM :

1
$bom | Update-BomWindowEntity -Status 'New' -StatusDetails 'BOM Header does not exist in ERP and will be created!'

Setting and updating properties of an Item:

1
2
3
$item | Update-BomWindowEntity -Properties @{"SomeCustomProperty" = "true"; "SomeOtherCustomProperty" = 6.66}
$item.'_Title(Item,CO)' = "A new title"
$item | Update-BomWindowEntity -Properties $item

Setting new properties to a BomRow by adding a note property member to the object:

1
2
3
$bomRow | Add-Member -MemberType NoteProperty -Name "Bom_SomeNewProperty" -Value "A new BOM property"
$bomRow | Add-Member -MemberType NoteProperty -Name "SomeNewProperty" -Value "A new Entity property"
$bomRow | Update-BomWindowEntity -Properties $bomRow

Updating the Item’s Status and StatusDetails, depending on the existence and equality to the material in ERP:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
function Check-Items($items) {
        foreach($item in $items) {
                $erpItem = Get-ERPObject -EntitySet 'Materials' -Keys @{'Number'=$item._PartNumber}
                if($erpItem -eq $null) {
                        $item | Update-BomWindowEntity -Status 'New'
                }else{
                        if( $item._Description -cne $erpItem.Description) {
                                $item | Update-BomWindowEntity -Status 'Different' -StatusDetails "Description is Different!"
                        }else{
                                $item | Update-BomWindowEntity -Status 'Identical'
                        }
                }
        }
}

Updating a standard BOM property on a BomRow:

1
$bomRow | Update-BomWindowEntity -Properties @{"Bom_PositionNumber" = 4}