VMware Cloud Community
hleibowi
Contributor
Contributor

Any simple way to pull the current date and time and apply it to a Property in vRA?

Hello and thanks for taking the time to help me out.

Basically, I’m trying to make it so when a blueprint is request, it creates a folder in vSphere that creates a tree that goes <name>/<project>/<date-time> based mostly on user inputs, and then dumps the provisioned vm's in there.

The blueprint prompts for the username and the project they are working on, and then creates that folder tree in vSphere but also creates another sub folder of <date-time>.

I've created a Property Group, that says to put the VM in a folder tree in vSphere with the structure of  <name>/<project>/<date-time>.

I’ve then been able to create Property Definitions for <name> and <project>, and when a user enters them during the blueprint request, it does go to vSphere and it does create that folder structure and dumps the VM's in there. This is as expected.

The problem is getting a Property Definition for <date/time>.

When setting up a Property Definition, It does a have a Date/Time picker in there but I don't want the user to be able to pick the date/time, i just want it to be the current date/time that the blueprint was provisioned.

Is there any way to easily extract the current date time and then apply it to a 'Date/Time' Property Definition? or some other way to apply the current date time to the folder structure?

Hope that makes sense.

Thanks for your time.

0 Kudos
4 Replies
daphnissov
Immortal
Immortal

The property you want in this case is creationDate and so if you can grab the value of that property you can use that when constructing VMware.VirtualCenter.Folder with the rest of that string.

0 Kudos
hleibowi
Contributor
Contributor

Sorry, I haven't had any luck getting the property creationDate into the VMware.VirtualCenter.Folder, or basically getting the creationDate value at all.

Any chance I could get some more detail on how to get that value? or a current time/date value at all into a property definition.

Thank you.

0 Kudos
daphnissov
Immortal
Immortal

Try dateSubmitted or dateCreated instead.

0 Kudos
daphnissov
Immortal
Immortal

Apologies for the corrections, but I tested this out in my environment. The correct property to grab the date when the request was submitted is "creationDate" and not any of the others. I am using the SovLabs Property Toolkit to create custom vCenter folders, but it should work with a manual coding approach as well.

pastedImage_0.png

In any case, there above you can see I've used this property to extract the submission date and put it as a child folder under TST.

0 Kudos