# Update-FLCItem Updates properties and affected items and performs workflow actions on an existing Item in Fusion 360 Manage. ## Syntax ```powershell Update-FLCItem -Workspace -ItemId [-Properties ] [-WorkflowAction [-Comment ]] [-AffectedItems ] [] ``` ```powershell Update-FLCItem -InputObject [-Properties ] [-WorkflowAction [-Comment ]] [-AffectedItems ] [] ``` ## Parameters | Type | Name | Description | Optional | |---------------------------------------|----------------|---------------------------------------------------------------------------------------|------------------------------------------------------| | String | Workspace | The name of the workspace that contains the item | no (optional when *InputObject* is used) | | Long | ItemId | The ID of the item to update | no (optional when *InputObject* is used) | | [Item]() | InputObject | The Fusion 360 Manage item that should be updated. The argument accepts pipeline input | no (optional when *Workspace* and *ItemId* are used) | | Hashtable | Properties | The according fields in Fusion 360 Manage which should be updated | yes | | (Hashtable/PsObject)\[\] | AffectedItems | The items which should be linked to the according item. | yes | | String | WorkflowAction | The name of the Workflow Action which should be performed on the item | yes | | String | Comment | A comment associated with the performed Workflow Action | yes | ## Return type [Item]() ← on success.\ **empty** ← on failure. Exception/ErrorMessage can be accessed using [\$Error](). ## Remarks The cmdlet supports passing all versions of an item.\ This means that for a *revision-controlled* workspace, not only *working versions* but also the *latest versions* of an item can be updated. ### Properties To update the properties of a Fusion 360 Manage item, the *-Properties* parameter allows passing a set of key-value pairs for the *fields* which should be updated.\ The name (key) of the properties is the same as displayed in the user interface of Fusion 360 Manage.\ Fields that are **not** declared in the hashtable, will **not** be updated in Fusion 360 Manage. In other words, only the passed fields will be changed. :::{admonition} Limitations and requirements :class: warning Additional information about the limitations and requirements of the possible fields can be found [here](). ::: ### Affected Items The Cmdlet can be used to *update the links* of an item to other existing items in Fusion 360 Manage.\ The passed *-Workspace* has to be [configured properly]() and must allow reading/writing the according affected items in the [Linked Items Tab]().\ This tab is often known as [Managed Items-]() or [Affected Items Tab]() (or even *"Workflow Items"*, *"Associated Change Orders"*, ...) within *revisioning* workspaces. The *required properties* for linking items can be passed using the `Workspace` and `Id` information. Additionally, it is possible to set or update custom [Linked Item Properties](). Specify the according fields and values as key-value pairs in the object passed to the *-AffectedItems* parameter (same as for the *-Properties* parameter). Moreover, items from revision-controlled workspaces can have the optional property `@{'LinkedItem_EffectivityDate'=...}` assigned. The [effectivity]() date is set to '*On Release*' when the property is not specified. By default newly created items in these workspaces have the lifecycle state [Unreleased]().\ Lifecycle transitions which are starting from such a state can be specified by using the `@{'LinkedItem_LifecycleTransition'= … }` property. When the property is not specified, no lifecycle transition will be assigned to the affected item. :::{admonition} Assign initial lifecycle transitions :class: warning When linking items from Revision Controlled Workspaces it is recommended to assign valid **lifecycle transitions** to all the newly added affected item links.\ In certain cases [Workflow Actions]() can not be performed on items when they contain affected items without lifecycle transitions specified (for instance when moving the item to a locked workflow state). ::: ### Workflow Action Workflow actions can only be performed on items in a [Workspace with Workflow](). When performing workflow actions on a Fusion 360 Manage item, various requirements must be taken into consideration in order to prevent failures when executing the Cmdlet. Possible restrictions can occur for example when the user does not have the required *Workflow permissions*, when *Workflow preconditions* or *validation controls* are not met, when attempting to change to an *invalid or impossible state*, if the item is in a *locked state* or if a *Comment* is required by a workflow action. The -Comment parameter is only available in combination with the -WorkflowAction parameter. **Update properties by passing the item as pipeline input** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $items = Get-FLCItems -Workspace 'Tasks' -Filter 'ITEM_DETAILS:TASK_ID=TK000059' $items[0] | Update-FLCItem -Properties @{ "Notes" = "All certification documents are up to date"; "Reviewers Assigned" = @("Berry, Jan") } <# Id : 7615 Workspace : Tasks RootId : 7615 WorkflowState : Open LifecycleState : Production Number : TK000059 Type : SIM CFD Description : Attach results summary of thermal CFD studies. Phase Needed By : Development Owner : Completed By : Reviewers Assigned : {Berry, Jan} Reviewed By : Notes : All certification documents are up to date Image : {255, 216, 255, 224...} Related Product : Orig Start Date : 13.12.2014 00:00:00 Orig End Date : 25.12.2014 00:00:00 Orig Duration : 12 #> ``` **Update item fields of various types** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $imageBytes = Get-Content -Path 'thumbnail.png' -Encoding Byte -Raw $item = Update-FLCItem -Workspace 'Items and BOMs' -ItemId 6796 -Properties @{ "Description" = $null #Field Type: Single Line Text "Unit of Measure" = "Cubic Centimeter" #Field Type: BOM UOM Pick List "Average Cost" = 9000.5 #Field Type: Money "RoHS" = $true #Field Type: Check Box "MPN_PREF1" = "Approved" #Field Type: Defined Pick List - Single Selection "Request Date" = (Get-Date) #Field Type: Date "Request Notes" = "

Updated paragraph!

" #Field Type: Paragraph "Process or Product Image" = $imageBytes #Field Type: Image } ``` **Add Affected Items to an existing item** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $affectedItemsToAdd = @() # Add item from a Revision Controlled Workspace $affectedItemToAdd = (Get-FLCItems -Workspace 'Items and BOMs' -Filter 'itemId=2886')[0] $affectedItemToAdd | Add-Member -Name "LinkedItem_LifecycleTransition" -Value "Initial Design Revision" -Type NoteProperty $affectedItemToAdd | Add-Member -Name "LinkedItem_EffectivityDate" -Value (Get-Date ...) -Type NoteProperty $affectedItemsToAdd += $affectedItemToAdd # Add item from a Non-Revision Controlled Workspace (no lifecycle transition and effectivity date can/must be specified) $affectedItemsToAdd += @{ "Id" = 123 "Workspace" = "Products" "LinkedItem_CustomField" = "My custom field" } $item = Update-FLCItem -Workspace 'Change Orders' -ItemId 6796 -AffectedItems $affectedItemsToAdd ``` **Update the workflow state of an item** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $item = (Get-FLCItems -Workspace 'Change Orders' -Filter 'itemDescriptor="CO000158"')[0] if($item.WorkflowState -eq 'Pushing to ERP') { $item = Update-FLCItem -InputObject $item -WorkflowAction 'Complete' -Comment 'State updated by powerFLC' } ``` **Error handling, analyze why updating Item Properties failed using \$Error** ```powershell Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId 'your_email@example.com' $item = Update-FLCItem -Workspace 'Approval Lists' -ItemId 7679 -Properties @{ "Applicable To" = '' } if(-not $item){ $Error[0].Exception #Returns "error.selectanoption: You must select an option for Applicable To" } ```