Hi All,
I have a workflow that takes an input parameter of type VC:VirtualMachine (name vm), the workflow calls a rest api, gets a job id back then waits a few seconds before starting a loop to check if the job is done or not.
This seemed to be working OK, but today I've noticed that the vm input parameter is changing to undefined during the workflow, to demonstrate I'm logging the vm name, then have a sleep timer for 10 seconds, then logging the vm name again. This is the output:
[2019-02-26 14:14:25.043] [I] VM: Server101
[2019-02-26 14:14:35.083] [I] VM: undefined
Log VM is just a script that is doing the following:
System.log("VM: "+vm.displayName);
Both take vm as the input parameter.
If I look at the variables as the workflow runs I can see this:
Then after a while goes to this:
Does anyone know what could be causing this behaviour (I've attached an export of the workflow)?
Thanks,
Tim.
You can save all the info you need into another variable or variables before deleting it.
What are you setting for overwriteExisting?
Hi,
overwriteExisting is just an input parameter that's consumed by a third party rest api, so same outcome no matter what this is set to.
Thanks,
Tim.
I do not have a way to import this to look at the moment but one of the first things to check is the bindings in the workflow. Would you be able to share the in and out bindings?
What's the result, though? Is the VM that you're restoring being overwritten or destroyed? Does it still exist after the field is being wiped out?
Ahhh, sorry, I understand what's happening now!
If I set overwriteExisting to false and in effect restoring to a new VM this is OK.
When overwriteExisting is set to true, a restore job kicks off which is overwriting the VM. I didn't realise the VC:VirtualMachine input parameter would actually be 'refreshed' as the workflow runs!
The issue is that I need the vm data to determine configuration data for use further down the line. Is there a way to cache this data and stop it from being wiped out? I've tried copying the input parameter to another attribute, but that gets wiped out too......
I'm quite new to this stuff so thanks for your help so far!
Tim.
You can save all the info you need into another variable or variables before deleting it.
Not the object itself, but the properties of the object you need.
Yep, will have to re-factor some code as I use VC:VirtualMachine everywhere!
Thanks again for your help