--- myst: substitutions: img_1: |- ```{image} /img/workflows/fusionmanage_lifecycleeditor.png :width: 600px ``` warning_1: |- :::{warning} * Possible restrictions can occur 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 or if the item is in a locked state. * Note that even if the Configuration Manager offers several Workflow Actions in the drop down menu, only valid/possible Actions will result in a successful execution of the job. ::: --- # Change Management ```{image} /img/workflows/vault_to_flc_and_back.png :align: right :width: 200px ``` This sample [Workflow]() is meant to display how to outsource a [Change Order]() from Fusion 360 Manage to Vault.\ It is designed to cover common user scenarios and to be easily extendable, because its workflow job is based on PowerShell and makes use of Cmdlets from [powerFLC]() and [powerVault]().\ The workflow therefore serves also as a base to create custom workflows. **Note:** The workflow synchronizes Change Order items from *Fusion 360 Manage → Vault* once they reach a configured *Workflow State*.\ It creates new representations for them in Vault and handles the assignment of properties, affected items and attachments.\ When such Vault Change Orders are closed, the workflow additionally updates the according Change Order item in Fusion 360 Manage and synchronizes its affected items from *Vault → Fusion 360 Manage*. :::{admonition} Requirements :class: warning - The default configuration expects a Fusion 360 Manage workspace named **"Change Orders"** of type *Revisioning workspace*.\ This workspace must be [configured properly]() in order to allow reading and writing affected items in the [Linked Items Tab](). - The [Transfer Item BOMs]() workflow ensures that Vault and Fusion 360 Manage are in a *synchronized state before* any operations are performed from this workflow. - In addition, the default configuration is designed to be used with the Autodesk example [PDMC Vault](). ::: ## Sample.SyncChangeOrders This [powerJobs Processor Job]() performs the synchronization of Change Orders in the following directions: The synchronization from **Fusion 360 Manage → Vault** gets triggered automatically on a regular basis of 10 minutes.\ The according [Workflow Trigger]() must be configured with the name of the Vault which should be synchronized.\ Afterwards the job retrieves all the Change Order items from Fusion 360 Manage which are located in a specific state and creates or updates the according Vault Change Orders.\ From the second run onwards, only newly created or modified Change Order items are retrieved from Fusion 360 Manage.\ They are created with the initial state "*Create*" using the default routing which is configured in Vault. The synchronization from **Vault → Fusion 360 Manage** gets performed when Vault Change Orders are closed.\ The according [Workflow Trigger]() must be configured for automatically queueing the job after changing the state of Vault Change Orders.\ The job updates the according Change Order item in Fusion 360 Manage, whereby the item records of the Vault Change Order will be assigned as new affected items.\ Removed item records will not be deleted from the affected items list.\ Afterwards a *Workflow Action* is performed, which indicates that the engineering changes are completed.\ Depending on the configuration in Fusion 360 Manage, this action transitions the item to a succeeding Workflow State. The transition can be defined in the Configuration Manager. The job connects and performs the actions to Fusion 360 Manage as the user entered in the [Tenant Settings]() of the Configuration Manager. **Attachments:**\ The attachments of the Change Order item in Fusion 360 Manage are downloaded into a temporary directory, by default under `C:\Temp\`.\ These documents are then uploaded to Vault and attached to the according Vault Change Order. Depending on whether they already exists in the Vault or not, the upload can behave in [various ways]().\ The target directory in Vault can be customized in the [Workflow Settings]() of the Configuration Manager. **Affected Items:**\ The job retrieves the affected items of the Change Order item in Fusion 360 Manage (even known as *"Managed Items"*, *"Workflow Items"* or *"Associated Change Orders"*) and tries to re-create these links on the Vault Change Order.\ This is only possible if the associated items exist in Vault.\ However, this should be the case when the **Transfer Item BOMs** workflow was executed before.\ When the according Vault Items cannot be found during the creation of the Vault Change Order, a comment describing this problem gets added. **Fields/Properties:**\ The job handles the synchronization of properties from Fusion 360 Manage to Vault by applying a *Item Field Mapping* [defined]() in the Configuration Manager. ## Configuration The Workflow State which triggers the job, the Vault folder path for attachments, the property mappings and many other things can be customized using the powerFLC Configuration Manager. A default configuration file with this settings gets delivered and should be [imported]() from the location *%ProgramData%\\coolOrange\\powerJobs\\Jobs\\Sample.SyncChangeOrders.json*.\ After the import, the predefined values of the imported configuration can be adjusted by accessing the Workflow Settings dialog in the Configuration Manager. ```{image} /img/workflows/sample.syncchangeorders_workflow_settings.png :width: 600px ``` A general description on how to configure the sections of the dialog is described [here](). **Note:** The [Unique Identifier]() *Vault Property* setting should not be changed, since the `Number` property uniquely identifies Vault Change Orders. The workflow makes use of the following [Workflow Settings](): | Name | Default | Value Description | |-------------------------------------|-----------------------------|-------------------| | Trigger State | Perform Change | All the Change Order items in Fusion 360 Manage with this workflow state are synchronized to Vault.| | Affected Items Lifecycle Transition | To Pre-Release | Specify a valid initial lifecycle transition which gets assigned to newly added affected items, when item records of a Vault Change Order are synchronized to Fusion 360 Manage.

{{ img_1 }}| | Workflow Action | Update Tasks | The Workflow Action that gets performed on synchronized Change Order items in Fusion 360 Manage.

{{ warning_1 }}| | Vault Attachments Folder | \$/Designs/Fusion Lifecycle | Attachments which are downloaded from the Change Order item in Fusion 360 Manage are stored in this specific Vault folder. They are uploaded into a subfolder with the name of the according Vault Change Order. | The workflow can be customized additionally in the [Item Field Mapping]() section.\ It contains mappings for defining which Vault Change Order properties should be filled with the values displayed in the [Item Details Tab]() of the according Change Order item in Fusion 360 Manage. ```{image} /img/workflows/item_field_mapping.png :width: 600px ``` The *Vault Change Order Property* set is limited to [User-Defined Properties](), except for the [System Properties]() `Title (Item,CO)`, `Description (Item,CO)` and `Due Date`. :::{warning} - *Properties* of type 'Image' are ignored - Specified *Functions* are ignored - The HTML formatting of the Fusion 360 Manage `Description` field will be removed since it is not supported by Vault. ::: ## Triggering the workflow Both synchronization directions of the workflow require their own trigger: **Fusion 360 Manage → Vault**: Regular time triggered jobs In order to enable the workflow for being triggered on a regular time interval, the name of the Vault which should be synchronized must be configured.\ To do so open the file *C:\\ProgramData\\coolOrange\\powerJobs\\Jobs\\Sample.SyncChangeOrders.settings* and uncomment the attribute `Vault`.\ Its value must specify the Vault name which will contain the Change Orders after the synchronization. ```{code-block} json :emphasize-lines: 5 :linenos: { "Trigger": { "TimeBased": "0 0/10 * 1/1 * ? *", "Vault": "{Your Vault database name}", "Priority": 101, "Description": "Queries Fusion 360 Manage for new/updated Change Orders" } } ``` Additionally it is possible to adapt when and in which intervals the workflow should be executed. By default the `TimeBased` setting specifies that a *"Sample.SyncChangeOrders"* job should be queued every 10 minutes.\ Moreover, it is possible to change the jobs priority and its description. Read more [here](). Notes: > - Make sure the `Priority` is set to a value greater than 100. This ensures, that the [Transfer Item BOMs](
) workflow is executed prior this workflow. > - Run the *powerJobs.exe* which automatically triggers the workflow job on a regular basis \ **Vault → Fusion 360 Manage**: Trigger on status changes in Vault The job *"Sample.SyncChangeOrders"* should be configured to be queued automatically after Vault Change Orders reach the desired *'Close'* state.\ This can be done by using the [Lifecycle Event Editor](). Read more [here](). ```{image} /img/workflows/lifecycle_event_editor.png :width: 700px ``` Notes: > - When the status of the Vault ChangeOrder gets changed to *'Close'*, then the states of its ItemRecords are changed to *'Released'*. Therefore the [Transfer Item BOMs](
) workflow gets automatically triggered for them.\ These *'Sample.TransferItemBOMs'* jobs have the same priority as the *'Sample.SyncChangeOrders'* jobs but they are executed prior this workflow, so that newly created Vault Items can be created in Fusion 360 Manage. Alternatively the job can even be queued within your own [client customization]() using powerEvents and the []() cmdlet, by passing the following [ChangeOrder parameters](): ```powershell $changeOrder = Get-VaultChangeOrder -Number 'ECO-00008' $job = Add-VaultJob -Name "Sample.SyncChangeOrders" -Parameters @{"ChangeOrderId"=$changeOrder.Id} -Description "Synchronize Change Order: $($changeOrder._Number)" ``` The Vault Event [UpdateChangeOrderState_Post]() provides information to act on the closure of Vault Change Orders.