VMware Cloud Community
michael_stefani
Enthusiast
Enthusiast
Jump to solution

Easiest way to get Owner of VM for workflow stub?

I'm trying to pull and use the owner of the VM in one of my workflows and it doesn't look like vCACVirtualMachine has that property available.  What's the easiest way to pull that into my workflow for future use?

0 Kudos
1 Solution

Accepted Solutions
SeanKohler
Expert
Expert
Jump to solution

You can try this... but there might be a timing issue on the Entity creation.

(I think there is a vcacvm.getEntity() method to get the actual entity.  I can't check right now.)

var ownerEntity = virtualMachineEntity.getLink(vCACHost, "Owner")[0];

var ownerName = ownerEntity.getProperty("UserName");

I think I have some other methods as well.  You are right to assume the requestor isn't always the owner.

View solution in original post

0 Kudos
3 Replies
SeanKohler
Expert
Expert
Jump to solution

You can try this... but there might be a timing issue on the Entity creation.

(I think there is a vcacvm.getEntity() method to get the actual entity.  I can't check right now.)

var ownerEntity = virtualMachineEntity.getLink(vCACHost, "Owner")[0];

var ownerName = ownerEntity.getProperty("UserName");

I think I have some other methods as well.  You are right to assume the requestor isn't always the owner.

0 Kudos
JoJoGabor
Expert
Expert
Jump to solution

Do you have the property __Legacy.Workflow.User available? I do in 6.2.1

So I use this to extract the requestor using the following pwoershell:

#passing the value of  __Legacy.Workflow.User to $Requestor through string replacement
$User = (($Requestor -split "@")[0])

0 Kudos
michael_stefani
Enthusiast
Enthusiast
Jump to solution

I ended up just setting the owner as a custom attribute during the initial provisioning.  Makes it easy to grab it during the workflow stubs.

0 Kudos