# Update-BomWindowEntity Updates an entity in the [BOM Window](). ## Syntax ```{code-block} powershell :linenos: true Update-BomWindowEntity [[-InputObject] ] [[-Status] ] [[-StatusDetails] ] [[-Properties] ] [] ``` ## 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 `/bom_window/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 [](), []() and []() in the [](): **Status and StatusDetails:**\ When updating the []() 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 []() of an entity, the progress in the []() 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 []() properties or the ones of the associated [](). *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 :** ```{code-block} powershell :linenos: true $bom | Update-BomWindowEntity -Status 'New' -StatusDetails 'BOM Header does not exist in ERP and will be created!' ``` **Setting and updating properties of an Item:** ```{code-block} powershell :linenos: true $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:** ```{code-block} powershell :linenos: true $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:** ```{code-block} powershell :linenos: true 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:** ```{code-block} powershell :linenos: true $bomRow | Update-BomWindowEntity -Properties @{"Bom_PositionNumber" = 4} ```