Using the Cmdlets

../../_images/flc_console.png

Start the powershell environment

In order to get started either open any powershell IDE and load the powerFLC Module by calling Import-Module powerFLC or open the powerFLC Console shortcut in the start menu, which already loads the powerFLC module for you.

Connect with Fusion Lifecycle

Before you are able to work with the Fusion Lifecycle tenant in your PowerShell environment you have to make sure that the tenant is configured correctly!

Next retrieve the Client ID and Secret of your registered powerFLC app from the Forge portal.

Find your tenants name by copying the first part of the URL from your browser, after you sign in to your Fusion Lifecycle Site.
For https://previewcoolorange.autodeskplm360.net/plm/mainDashboard the tenant name would be previewcoolorange.

Now you can authenticate using Connect-FLC and all the previously retrieved information.

$connected = Connect-FLC -Tenant 'your_tenant_name' -ClientId 'your_client_id' -ClientSecret 'your_client_secret' -UserId '[email protected]'

Get multiple items from Fusion Lifecycle

After successfully connecting to the Fusion Lifecycle tenant you can start using the cmdlets to interact with FLC items and workspaces.
To retrieve a collection of specific items from a Fusion Lifecycle workspace you can use the Get-FLCItems cmdlet.

Note

Get-FLCItems has the optional parameter -Filter that allows you to specify a string in the same format as Fusion Lifecycle searches to filter the result.

Get all items from the workspace Products that are in the workflow state Concept and have a field named Number with the exact value 900-00010:

$items = Get-FLCItems -Workspace 'Products' -Filter 'workflowState=Concept AND ITEM_DETAILS:NUMBER="900-00010"'

Update a Field of an Item

One of the previously retrieved Fusion Lifecycle Items can now be picked and updated using the update-flcitem cmdlet.
By navigating to the Workspace Manager in Fusion Lifecycle we can find a Item Details Form that provides us a list of possible Item Details Fields that can be edited.

In following example we edit the value of a simple Text Field with the name ‘Description’ by just extending the value with a suffix.

$itemToUpdate = $items[0]

$itemToUpdate| Update-FLCItem -Properties @{'Description'= "$($itemToUpdate.Description) - Edited"}

After executing the commandlet, it will return an Item with the updated ‘Description’ Field.