Hello,
I am new to java and I want to create a set of properties (name value pairs) so I can then create a soap request into vcac: Below is my code (I also want to log and print out the set so I can see it for debugging purposes).
var propertyName = new Properties();
var propertyValue = new Properties();
var properties = {
propertyName : [
"request.callback_required",
"disk1.size_mb",
"ram.size_mb",
"eurc.lob",
"cpu.count",
"backup.required.value",
"ad.domain_name",
"app.seal_id",
"cc.cost_center",
"itsm.change_approval_group",
"itsm.change_notify_group",
"network.zone.value",
"os.version_value",
"order.behalfof_sid",
"order.creator_sid",
"site.region",
"site.sam_id",
"sku.service_acronymn",
"storage_type",
"tams.app_resolver",
"tams.em_hours",
"tams.em_day",
"tams.em_time",
"tams.environment",
"tams.maintenance_hours",
"tams.maintenance_day",
"tams.maintenance_time",
"tams.os_resolver",
"tams.site_resolver",
"tams.support_team",
"windows.auto_patch_enabled",
"windows.recovery_time_objective",
"windows.server_role"
],
propertyValue : [
request_callback_required,
disk1_size_mb,
ram_size_mb,
eurc_lob,
cpu_count,
backup_required_value,
ad_domain_name,
app_seal_id,
cc_cost_center,
itsm_change_approval_group,
itsm_change_notify_group,
network_zone_value,
os_version_value,
order_behalfof_sid,
order_creator_sid,
site_region,
site_sam_id,
sku_service_acronymn,
storage_type,
tams_app_resolver,
tams_em_hours,
tams_em_day,
tams_em_time,
tams_environment,
tams_maintenance_hours,
tams_maintenance_day,
tams_maintenance_time,
tams_os_resolver,
tams_site_resolver,
tams_support_team,
windows_auto_patch_enabled,
windows_recovery_time_objective,
windows_server_role
]
}
System.log("here are the new properties" + propertyName + " " + propertyValue);
for each (var vmProp in properties){
var propName = vmProp.get(propertyName);
var propValue = vmValue.get(propertyValue);
System.log ("found prop" + propName + " " + propValue);
}
I get the error below however:
TypeError: Cannot find function get in object
Welcome to vCO, implementing properties objects in vCO is more like this:
var props = new Properties();
props.put("myPropName", "myPropValue");
Add as many .put lines to add your various properties - the values can be objects as well as strings.
Use the API Explorer to learn more about the available properties and methods of the Properties object.
To review the contents of a properties object:
for each (key in props.keys){
System.log(key +": "+props.get(key));
}
Welcome to vCO, implementing properties objects in vCO is more like this:
var props = new Properties();
props.put("myPropName", "myPropValue");
Add as many .put lines to add your various properties - the values can be objects as well as strings.
Use the API Explorer to learn more about the available properties and methods of the Properties object.
To review the contents of a properties object:
for each (key in props.keys){
System.log(key +": "+props.get(key));
}
I am not completely sure about your syntax, but usually in JAvaScript in vCO you use
var myProps = new Properties();
myProps.put("aKeyString", aValueObject);
to "fill" the properties, and
for each (var key in myProps.keys) {
var currentValue = myProps.get(key);
}
Cheers,
Joerg
Edit: damn, once again too late 🙂 Not my day today. Anyway, found a error in my original code, corrected in place now (the method is called put(key, value)..... )
cool thank you!
Thank you as well! yea I was able to get it to work now