Giuseppe08
Contributor
Contributor

Actions based on a variable

Hi everyone,
in vRO is there a way to make an action based on a variable ?
Tags (1)
0 Kudos
5 Replies
xian_
Expert
Expert

Explain what you want to do in a more detailed way

0 Kudos
Giuseppe08
Contributor
Contributor

Hi thanks for the reply,

I have to add a tag to a vm based on the storage name ; if the storage name contain i.e "dr" this is a vm under disaster recovery and I have to add a tag: "machine dr"

0 Kudos
xian_
Expert
Expert

I see. You have not said if this is a standalone vRO or vRA embedded. Also, is this version 7 or version 8?

There are quite a few solutions on this forum for similar requirements, if you search for "tag vm". 

0 Kudos
Giuseppe08
Contributor
Contributor

HI, i'm novice vRO User. This is an vRA embedded. And the version is the 7.6. I searched but i didn't find what i'm looking for. During a workflow if the input as a variable contains a word "DR" there is an action that add a tag only if input variable have this contain the value DR.

0 Kudos
emacintosh
Enthusiast
Enthusiast

I can't help with adding the tag, but in general i think you just want to add a custom decision element to your workflow.  That element will expect a script that returns true or false.  And then you can drag the true arrow to the "add tag" action and the false arrow to the end (or whatever else you have to do next).  So just some simple javascript like this (be sure to have yourVar as an input).

if(yourVar.toUpperCase().indexOf("DR") >= 0) {
  return true;
}
return false;

Also, if you're looking to get beyond the novice status for vRO, I would highly recommend checking out the vvork channel on youtube - he has an incredibly well done tutorial for vRO in 7.x.