TimDScott
Enthusiast
Enthusiast

Input parameter of type VC:VirtualMachine goes to undefined mid way through workflow

Jump to solution

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

pastedImage_0.png

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:

pastedImage_4.png

Then after a while goes to this:

pastedImage_5.png

Does anyone know what could be causing this behaviour (I've attached an export of the workflow)?

Thanks,

Tim.

0 Kudos
1 Solution

Accepted Solutions
filosmith
Enthusiast
Enthusiast

You can save all the info you need into another variable or variables before deleting it.

View solution in original post

0 Kudos
8 Replies
filosmith
Enthusiast
Enthusiast

What are you setting for overwriteExisting?

0 Kudos
TimDScott
Enthusiast
Enthusiast

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.

0 Kudos
sbeaver
Leadership
Leadership

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?

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
filosmith
Enthusiast
Enthusiast

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?

0 Kudos
TimDScott
Enthusiast
Enthusiast

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.

0 Kudos
filosmith
Enthusiast
Enthusiast

You can save all the info you need into another variable or variables before deleting it.

View solution in original post

0 Kudos
filosmith
Enthusiast
Enthusiast

Not the object itself, but the properties of the object you need.

0 Kudos
TimDScott
Enthusiast
Enthusiast

Yep, will have to re-factor some code as I use VC:VirtualMachine everywhere!

Thanks again for your help Smiley Happy

0 Kudos