# Getting started ## Automatic creation of visualization files on Lifecycle State Change to Released powerEvents is installed with sample events which allow to react to different actions in Vault with custom code.\ The *Sample.SubmitPublishingJobsOnRelease* was created to react to lifecycle state changes in Vault. ```{image} img/powerevents_ise.png :align: right :width: 250px ``` To activate it, all you have to do is to enable the sample script which will trigger publishing jobs when certain Inventor or AutoCAD files are released in Vault.\ Afterwards the [Sample.CreatePDF](powerjobs_processor:jobprocessor/jobs/sample_jobs:sample.createpdf) and [Sample.CreateDXF&STEPfromSheetmetal](powerjobs_processor:jobprocessor/jobs/sample_jobs:sample.createdxf&stepfromsheetmetal) jobs will be queued for them automatically.\ The event script is highly customizable and can be used as a template for easily creating a custom script which fits your needs! ```{admonition} Requirements :class: warning [powerJobs Processor]() must be installed on a Job Processor environment and must be running in order to process the queued publishing jobs. ``` ## Start the Powershell environment In order to get started either open any Powershell IDE or open the *powerEvents ISE* shortcut in the start menu, which already opens the event script *Sample.SubmitPublishingJobsOnRelease.ps1* for you. ```{admonition} Open event script as Administrator :class: note On some systems the directory "*C:\\ProgramData\\*" is write protected so you need to start your editor as Admin, by right clicking *Windows PowerShell ISE* in the start menu and clicking "Run as administrator".\ Afterwards select "File" -> "Open..." (or press \{CTRL}+O) and open the file "*C:\\ProgramData\\coolOrange\\powerEvents\\Events\\Sample.SubmitPublishingJobsOnRelease.ps1*". ``` ## Activate publishing job In order to enable the event script [Sample.SubmitPublishingJobsOnRelease](event_scripts:Sample.SubmitPublishingJobsOnRelease) change line 10 from ```{code-block} PowerShell :lineno-start: 10 #Register-VaultEvent -EventName UpdateFileStates_Post -Action 'SubmitPublishJobs' ``` To ```{code-block} PowerShell :lineno-start: 10 Register-VaultEvent -EventName UpdateFileStates_Post -Action 'SubmitPublishJobs' ``` After un-commenting the [Register-VaultEvent](/code_reference/commandlets/register-vaultevent) call you need to save the changes in the powerShell script by selecting "File" -> "Save" (or press \{CTRL}+S). ## Release a Vault File ```{admonition} Activate job queue :class: note In order to follow this getting started guide, the [Job Queue in your Vault needs to be enabled](https://knowledge.autodesk.com/support/vault-products/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/Vault-Admin/files/GUID-1F9F4E1D-9B12-44DF-B005-3AA3025E7B04-htm.html). ``` Start your Vault Client and navigate to a Inventor- or AutoCAD drawing to publish a PDF file, or to a Sheet Metal part to publish a DXF and STEP file and change its state to "**Released**".\ In this example we have selected the “**SubmitPdfJobOnRelease.idw** ” drawing. ```{image} img/vault-release-idw.png :width: 650px ``` ## Result In your job queue there should be a new job of the type "*Sample.CreatePDF*". If you open the job queue now, you will see your job in here.\ You can find the job queue in the menue at **Tools → Job Queue**. ```{image} img/sample.SubmitPublishingJobsOnRelease_jobqueue.png :width: 900px ```