How to extend a Transfer Vault BOM Workflow job to keep manually added bomRows in FLC

When syncing the Vault BOM information to Fusion Lifecycle all the BOM line items that were manually added to the item are getting removed. 

The Transfer Vault File BOM Workflow job can be extended to find these line items and re-upload them together with all the bomRows coming from Vault. 

Required Fusion Lifecycle configuration

In order to allow differentiating between manually added BOM line items and bomRows that were added from powerFLC, a new Custom BOM Field(Autodesk) is required in the FLC Bill of materials tab(Autodesk).

If you are using the "Vault Items and BOMs" workspace this step is not required since the workspace already has this field.

For other workspaces follow these steps to add the field to the Bill of materials tab:

Navigate to the Workspace Manager, find your Workspace and the BOM Tab configuration. We recommend creating a new BOM Field of type Picklist(Autodesk) called e.g. "Source" with the defined values "Fusion Lifecycle" and "Vault".

In order to not force Fusion Lifecycle users to specify the correct Field value when adding BOM list items, we can specify the Default Value to be "Fusion Lifecycle" for the previously created BOM Field.

The custom BOM Field must be added to at least one View.

Workflow to keep manually added BOM line items

With this configuration it is possible to retrieve manually added BOM line items for items in Fusion Lifecycle and only override the bomRows that are coming from Vault.

In order to keep the following examples as simple as possible, we assume that the according Fusion Lifecycle items where already created.

Find examples for creating or updating them automatically in How to create a custom Transfer Vault File BOM Workflow job on the coolOrange knowledge base.

Find header item

In the following example we search for the respective item of a file in Vault using its "Part Number" property.

The header item is searched in the 'Items and BOMs' workspace using the Field "itemID" and the "_PartNumber" property from the powerVault File object.

When working with revision-controlled workspaces the "Part Number" in Vault and the "itemID" Field in Fusion Lifecycle must stay the same for all item revisions in Fusion Lifecycle in order to find the according item.

Extend your custom Transfer Vault BOM Workflow job with:

Import-Module powerVault
Open-VaultConnection
$file = Get-VaultFile -Properties @{"File Name"="Pad Lock.iam"}

$item = (Get-FLCItems -Workspace 'Items and BOMs' -Filter ('ITEM_DETAILS:ITEMID="{0}"' -f $file._PartNumber))[0]

Find manually added bomRows

In order to get the current BOM information for the Fusion Lifecycle item we can use the Get-FLCBOM cmdlet. 

Following example filters for manually added BOM line items using the previously described "Source" BOM Field:

$bomRows = $item | Get-FLCBOM$manuallyAddedBomRows = $bomRows | Where-Object {$_.Bom_Source -ne "Vault"}
Get BOM information from Vault

Next we can retrieve the Vault file BOM information and find the respective Fusion Lifecycle items for all the components similar as we did for the header item.

As described before we assume that the according items already exist in Fusion Lifecycle.

We retrieve all the according items in a single Get-FLCItems step by combining them with OR conditions.

Note that we have to mark all this items to be retrieved from Vault by using the "Bom_Source" property

$vaultBomRows = @()$fileBom = Get-VaultFileBom -File $file._FullPath$childItems = Get-FLCItems -Workspace $item.Workspace -Filter (($fileBom | foreach-object {'ITEM_DETAILS:ITEMID="{0}"' -f $_.'Bom_Part Number'}) -join ' OR ') foreach ($fileBomRow in $fileBom) {    $childItem = $childItems | where-object { $_.itemID -eq $fileBomRow.'Bom_Part Number' }[0]    $vaultBomRows += @{        'Bom_PositionNumber'= $fileBomRow.Bom_PositionNumber        'Workspace' = $childItem.Workspace        'Id'= $childItem.Id        'Bom_Quantity'= $fileBomRow.Bom_Quantity        'Bom_Source' = 'Vault'    }}

Update BOM information in Fusion Lifecycle

Now we can simply update the BOM information of the Fusion Lifecycle item using Update-FLCBOM cmdlet, by passing the Vault File BOM data together with the previously retrieved BOM line items that where added manually in Fusion Lifecycle:

$item | Update-FLCBOM -Rows ($vaultBomRows + $manuallyAddedBomRows)

See Also