# Update-FLCBOM Manipulates the BOM of an existing Item in Fusion 360 Manage. ## Syntax ```powershell Update-FLCBOM -Workspace -ItemId -Rows [] ``` ```powershell Update-FLCBOM -InputObject -Rows [] ``` ## Parameters | Type | Name | Description | Optional | |---------------------------------------|-------------|-------------------------------------------------------------------------|------------------------------------------------------| | String | Workspace | The name of the workspace that contains the header Item | no (optional when *InputObject* is used) | | Long | ItemId | The ID of the BOM header Item | no (optional when *InputObject* is used) | | [Item]() | InputObject | The Fusion 360 Manage header Item. The argument accepts pipeline input | no (optional when *Workspace* and *ItemId* are used) | | (Hashtable/PsObject)\[\] | Rows | Overrides all BOM line items with the passed BOM line items information | no | ## Return type [BomRow[]]() ← on success.\ **empty** ← on failure. Exception/ErrorMessage can be accessed using [\$Error](). ## Remarks The Cmdlet can be used to add *existing Items* to a BOM, edit BOM line items and delete Items from a specific BOM in Fusion 360 Manage. The passed **-Workspace** has to be [configured properly]() and must allow linking the passed items. In order to override the current BOM line items the **-Rows** argument allows passing BOM information for Items from *different Workspaces* that should be *added* or *edited* on the according header Item.\ All the BOM items that are not present in the array will be *deleted* from the BOM (not from the Workspace). The *required information* for linking Fusion 360 Manage Items can be passed using the `Workspace` and `Id` properties.\ For BOM line items from *​revision-controlled*​ workspaces, always the *latest versions* of the passed items are linked, even if *work versions* of the respective items are passed. The argument allows passing the name and value for all the [Standard BOM Fields]() and [Custom BOM fields]() using the *'Bom\_'* prefix (e.g `Bom_Quantity`) regardless of the used display names in the different [BOM Views]().\ Only *BOM Fields* that are assigned to a *View* in the [Bill of Materials Tab]() can be specified.\ For those BOM fields which are not present in the Hashtable or PsObject, a configured default value is used when a new line item is added. For example auto-numbering is used when no `Bom_PositionNumber` field is supplied\ When editing existing BOM line items, the value in Fusion 360 Manage is kept untouched.\ Additional information about the limitations and requirements of the possible *BOM Field Types* can be found [here](). :::{admonition} Not editable Fields :class: warning Fields that are *not editable* in the [Bill of Materials Tab]() (e.g. computed [Roll Up Fields]()) can not be updated using this cmdlet. ::: ## Examples To use the examples below a [Fusion 360 Manage PLM demo]() Tenant is required: **Update a BOM and its fields for an Item in Fusion 360 Manage** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $bomRows = Update-FLCBOM -Workspace 'Products' -ItemId 7557 -Rows @( @{ 'Bom_PositionNumber'=1 #Field Type: Integer 'Workspace' = 'Products' 'Id'=7549 'Bom_Quantity'= 6.96 #Field Type: Float }, @{ 'Workspace' = 'Items and BOMs' 'Id' = 8065 'Bom_CustomCheckbox' = $false #Field Type: Check Box } ) ``` **Override only specific line items in a BOM** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $item = (Get-FLCItems -Workspace 'Items and BOMs' -Filter '"699-00007 - BAC Mono mk1 custom steering wheel"')[0] # all the filtered out items will be removed $existingBomRows = ($item | Get-FLCBOM) | Where-Object { $_.Description -ne 'Push Button' } $existingBomRows[0].Bom_Quantity = 2.0 $newBomRows = (Get-FLCItems -Workspace 'Items and BOMs' -Filter '"Push Button"') | Select-Object -Property Workspace, Id, @{Name = 'Bom_Quantity'; Expression = {1.0}} $bomRows = $item | Update-FLCBOM -Rows ($existingBomRows + $newBomRows) ``` **Create a BOM and its associated Items in Fusion 360 Manage from the Structured BOM of a Vault File** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $file = Get-VaultFile -Properties @{Name = 'Pad Lock.iam'} $fileBom = Get-VaultFileBOM -File $file._FullPath $flcBomRows = @() foreach($fileBomRow in $fileBom) { $flcBomRowItem = Add-FLCItem -Workspace 'Items and BOMs' -Properties @{ 'Description' = $fileBomRow._PartNumber 'Unit of Measure' = 'Each' } $flcBomRows += @{ 'Id' = $flcBomRowItem.Id 'Workspace' = $flcBomRowItem.Workspace 'Bom_PositionNumber' = $fileBomRow.Bom_PositionNumber 'Bom_Quantity' = $fileBomRow.Bom_Quantity } } $flcItem = Add-FLCItem -Workspace 'Items and BOMs' -Properties @{'Description' = $file._PartNumber} $flcBomRows = $flcItem | Update-FLCBOM -Rows $flcBomRows ``` **Error handling, analyze why adding Items to a BOM failed using \$Error** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $childItems = Get-FLCItems -Workspace 'Items and BOMs' -Filter 'ITEM_DETAILS:DESCRIPTION="Gear Shift Paddle"' $bomRows = Update-FLCBOM -Workspace 'Items and BOMs' -ItemId 8071 -Rows $childItems if(-not $bomRows){ $Error[0].Exception # Returns "error.bom.cyclical: Saving these changes produces a cyclical BOM, this is not permitted" } ``` **Error handling, analyze why several bomRows could not be updated using \$Error** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $bomRows = Update-FLCBOM -Workspace 'Items and BOMs' -ItemId 6862 -Rows @( @{ 'Workspace' = 'Items and BOMs' 'Id'=8213 'Bom_PositionNumber'= "Invalid_Pos" #Invalid position number }, @{ 'Workspace' = 'Items and BOMs' 'Id' = 0 #Invalid item Id } ) if(-not $bomRows){ $Error[0].Exception # Returns System.AggregateException: "One or more errors occurred." $Error[0].Exception.InnerExceptions # Returns: "Input string was not in a correct format." # "No Item found with the given id: 0." } ```