VMware Cloud Community
DLally
Enthusiast
Enthusiast
Jump to solution

vRA 7.2 workflow template help

So I'm  used to 6.2 that came with a workflow template.  Everything was predefined on what I need to have.

Then I just created new variables that extracted my values from vCACVmProperties.

ex: var user = vCACVmProperties.get('__Legacy.Workflow.User');

From what I've ready, I should just be able to create a payload property that would bring in all the properties like before....but how do i extract those?

something like this?  var user = payload.get('__Legacy.Workflow.User'); ?

I wish they created a similar workflow template for 7.2, like they did with 6.2, especially with the new changes.

0 Kudos
1 Solution

Accepted Solutions
bdamian
Expert
Expert
Jump to solution

Ok, I get it.

I'll write a post with this info but, in the meantime, the steps are the following:

1.- You need to be sure that your subscription is "Blocking". This is a checkbox at the end of the subscription but you cannot change it after created. This option tells vRA to wait until the workflow ends its execution and look for an answer. If the subscription is non blocking, vRA executes async and moves on.

2.- The event broker doesn't send all the info to the workflow. To ask vRA for all the info you have to add a custom property in your blueprint. In this case, you need to add this:

Name: Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.BuildingMachine

Value: *

3.- Your workflow must have only one Input Parameter: payload (type Properties)

4.- You look in the "payload" object to find the custom property you need. Remember that the type "Properties" its a sort of Dictionary. So you can ask for a custom property of the VM with something like this:

var prop = payload.get('machine').get('properties').get('name.of.the.custom.property');

5.- If you want to tell vRA to add or update a Machine custom property, your workflow must have an Output Parameter called "virtualMachineAddOrUpdateProperties" of type Properties. Must have that exact name, otherwise vRA will ignore it.

This is an example:

var addProperties = new Properties();

addProperties.put('name.of.the.property.to.update.or.create', 'value.of.the.property');

virtualMachineAddOrUpdateProperties = addProperties;

(where virtualMachineAddOrUpdateProperties is your Output Parameter)

Hope this helps.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian

View solution in original post

0 Kudos
7 Replies
bdamian
Expert
Expert
Jump to solution

Hi DLally,

A couple of questions:

. What event of the Event-Broker are you subscripted to? (Building Machine, Provisioned Machine, etc)

. What do you need to do after getting the value of the custom property?

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

I have building machine, provisioned, deleted workflows that do all sorts of things for us.  Based on user input, actions are taken, etc.

So i'd need to extract those values again using the new payload way, i'm just not sure the proper method to do this.

One example, we take user input which then vCO takes that input and generates a name which then inserts that into vRA again to rename the server.

0 Kudos
bdamian
Expert
Expert
Jump to solution

Ok, just to confirm:

You have a workfow to define the name of the VM based on Custom Properties of the Blueprint. So you have a subscription in the Event-Broker for VMPSMasterWorkflow32.BuildingMachine and State = PRE. When the wofkflow is called, you need to:

  • Get the value of the Custom Property
  • Set a new value for the Machine Name

Is that correct?

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

Pretty much yes, I need to call that property again using this payload system.  I'm not sure of the proper way to do that.  Then when I'm done creating that name, I will have to push that back to vRA.  Previously I just called Update a vCAC entity to do that.

0 Kudos
bdamian
Expert
Expert
Jump to solution

Ok, I get it.

I'll write a post with this info but, in the meantime, the steps are the following:

1.- You need to be sure that your subscription is "Blocking". This is a checkbox at the end of the subscription but you cannot change it after created. This option tells vRA to wait until the workflow ends its execution and look for an answer. If the subscription is non blocking, vRA executes async and moves on.

2.- The event broker doesn't send all the info to the workflow. To ask vRA for all the info you have to add a custom property in your blueprint. In this case, you need to add this:

Name: Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.BuildingMachine

Value: *

3.- Your workflow must have only one Input Parameter: payload (type Properties)

4.- You look in the "payload" object to find the custom property you need. Remember that the type "Properties" its a sort of Dictionary. So you can ask for a custom property of the VM with something like this:

var prop = payload.get('machine').get('properties').get('name.of.the.custom.property');

5.- If you want to tell vRA to add or update a Machine custom property, your workflow must have an Output Parameter called "virtualMachineAddOrUpdateProperties" of type Properties. Must have that exact name, otherwise vRA will ignore it.

This is an example:

var addProperties = new Properties();

addProperties.put('name.of.the.property.to.update.or.create', 'value.of.the.property');

virtualMachineAddOrUpdateProperties = addProperties;

(where virtualMachineAddOrUpdateProperties is your Output Parameter)

Hope this helps.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos
DLally
Enthusiast
Enthusiast
Jump to solution

You're awesome, think I understand it a bit better now.  I just need to test and play with it a bit too.

one question... so for example I wanted to pull a property environment would I do something like this? The bold will always be the same and just update the last part with the property name that i need the value from?

var prop = payload.get('machine').get('properties').get('environment');

0 Kudos
bdamian
Expert
Expert
Jump to solution

Yes, you can get the value of the property like that.

It is not very difficult to write a piece of code to show all the content of the payload so you can see all info that vRA sends to the workflow. You can see a model of the payload when you create the subscription.

pastedImage_0.png

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
0 Kudos