VMware Cloud Community
vmwaredownload
Enthusiast
Enthusiast

Type casting in vCO?

Hi,

We are using Create Business Group workflow in vCO 5.5.2. We have customized a workflow which takes the data from a csv file and passes on the required values to Create Business Group workflow. Since the Business Group workflow has certain input parameters of type vCACCAFE:MachinePrefix, Array/String and Array/CompositeType, is there any way to convert to the String that is obtained from csv file to the above mentioned types? Is it possible to use javascript to do the above thing?

-SK

0 Kudos
1 Reply
smithgp
Enthusiast
Enthusiast

For the machine prefixes, have you tried using vCACCAFEEntitiesFinder.findMachinesPrefixes(host, name)? e.g.:

var prefixes = vCACCAFEEntitiesFinder.findMachinesPrefixes(host, nameFromCSV);

for (var i = 0; i < prefixes.length; i++) {

    // findMachinesPrefixes assume a name query, so do exact match here

    if (prefixes[i].name === nameFromCSV) {

        thePrefix = prefixes[i];

        break;

    }

}

For Array/String, you should just be able to create that in javascript, e.g. var a = new Array(); a[0] = 'foo';

I'm not sure about the CompositeTypes. Does that map to javascript objects? e.g. var c = { name1: 'foo', name2: 'bar' };

Greg

0 Kudos