vCommander® workflows may be configured to run only when a certain condition exists. When configuring a workflow comprised of one or more conditional steps, you can also use conditions to create a dependency between steps. Doing so allows you to include flexibility and control over what happens during workflows without multiplying the overall number of workflows that you have configured in the system.


For example, you might want to provide functionality to Service Portal users to backup their VMs using a script you’ve developed, but this requires the VM to be powered off before it runs. You also want to make sure that if the user requested the backup while the VM was powered on, it be returned to that state. Here’s how these steps would look configured as a Command Workflow.


The first step powers down the VM if it’s in any other state besides Not running. To do so, you make the step conditional using the following syntax:


#{target.state} -ne "Not running"


It’s important to handle this step this way, instead of making the execution conditional on the state Running because there are many states a VM can be in (including Saved, Starting, Stopping, Suspended and more).


Choose Shutdown Guest OS & Stop VM as the action. Make sure to add a step to wait for the VM to power down completely.


In our example, the next step runs a script.


Finally, our example needs to have a third step run to power the VM back on, but only if the VM was powered off in the first step. To do this, you create another power action step that works conditionally on whether or not step 1 was skipped.


This is the correct syntax:


#{steps[1].skipped} -eq true


You can use the same basic principles to create dependencies between any two steps in a workflow.