Update-FLCItem
Updates properties and affected items and performs workflow actions on an existing Item in Fusion 360 Manage.
Syntax
Update-FLCItem -Workspace <String> -ItemId <Long> [-Properties <Hashtable>] [-WorkflowAction <String> [-Comment <String>]] [-AffectedItems <Object[]>] [<CommonParameters>]
<#
PARAMETER
-Workspace
Required true
-ItemId
Required true
-Properties
Required false
-WorkflowAction
Required false
-Comment
Required false
-AffectedItems
Required false
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Directly passing an Item object:
Update-FLCItem -InputObject <PSObject> [-Properties <Hashtable>] [-WorkflowAction <String> [-Comment <String>]] [-AffectedItems <Object[]>] [<CommonParameters>]
<#
PARAMETER
-InputObject
Required true
Accepts pipeline input: true
-Properties
Required false
-WorkflowAction
Required false
-Comment
Required false
-AffectedItems
Required false
<CommonParameters>
This cmdlet supports the common parameters: ErrorAction, ErrorVariable
#>
Parameters
Type |
Name |
Description |
---|---|---|
String |
Workspace |
The name of the workspace that contains the item |
Long |
ItemId |
The ID of the item to update |
InputObject |
The Fusion 360 Manage item that should be updated. |
|
Hashtable |
Properties |
The according fields in Fusion 360 Manage which should be updated |
(Hashtable/PsObject)[] |
AffectedItems |
The items which should be linked to the according item. |
String |
WorkflowAction |
The name of the Workflow Action which should be performed on the item |
String |
Comment |
A comment associated with the performed Workflow Action |
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.
Limitations and requirements
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.
Assign initial lifecycle transitions
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
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$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
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$imageBytes = Get-Content -Path 'thumbnail.png' -Encoding Byte -Raw
$item = Update-FLCItem -Workspace 'Items' -ItemId 6796 -Properties @{
'Title' = 'required' #Field Type: Single Line Text
'Description' = '<p><b>Updated paragraph!</b></p>' #Field Type: Paragraph
'Type' = $null #Field Type: Radio Button
'Unit of Measure' = 'Cubic Centimeter' #Field Type: BOM UOM Pick List
'Estimated Cost' = 9000.5 #Field Type: Money
'Country' = 'United States' #Field Type: Defined Pick List - Single Selection
'PDM Last Modification Date' = (Get-Date) #Field Type: Date
'Image' = $imageBytes #Field Type: Image
#'My custom checkbox' = $true #Field Type: Check Box
}
Add Affected Items to an existing item
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$affectedItemsToAdd = @()
# Add item from a Revision Controlled Workspace
$affectedItemToAdd = (Get-FLCItems -Workspace 'Items' -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
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$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
Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'
$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"
}