Comparing to the server provisioning and VM archive, this workflow is a little bit more complicated. What it does is Checking the power status –> Shutdown VM if it is running –> Archive the VM –> Send requester the archive results –> Ask user to confirm whether to remove the VM –> Send the result to requester.
The key steps are:
1) Check the power status in the Custom decision
var powerState = vm.runtime.powerState.value;
System.log (powerState);
if (powerState == ‘poweredOff’) {
return true;
} else {
return false;
}
2) Add the VM archive workflow which I created already.
3) Set a boolean type parameter in the User Interaction which allow user to choose Yes or No.
Custom decision based on user’s choice.
System.log (choice);
if (choice == true) {
return true;
} else {
return false;
}
This is how it looks like when running: