To use this function add it to the class library file named Utilities.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: Utilities.ts
Relevant VMware KB Article Number: 445540
Relevant VMware KB Article URL: https://knowledge.broadcom.com/external/article/445540/custom-forms-fail-to-validate-with-error.html
Description: Orchestrator Function to Convert a Properties Object to an Array of Properties
Function ConvertPropertiesToArrayOfProperties ( for v9.1 and later )
public static ConvertPropertiesToArrayOfProperties(objPropertiesInput: Properties): { key: string, value: string, description: string }[] {
let arrDropdown: { key: string, value: string, description: string }[] = objPropertiesInput.keys.map((strKey: string): { key: string, value: string, description: string } => {
let strValue: string = objPropertiesInput.get(strKey);
let objDropdown: { key: string, value: string, description: string } = {
key: strKey,
value: strValue,
description: strKey
};
return objDropdown;
});
return arrDropdown;
}TypeScriptFunction ConvertPropertiesToArrayOfProperties ( for v8.x and v9.0 )
public static ConvertPropertiesToArrayOfProperties(objPropertiesInput: Properties): Properties[] {
let arrProperties: Properties[] = [];
let arrKey: string[] = objPropertiesInput.keys;
arrKey.forEach((strKey: string): void => {
let strValue: string = objPropertiesInput.get(strKey);
let objProperties: Properties = new Properties()
objProperties.put("label", strValue);
objProperties.put("value", strKey);
objProperties.put("description", strKey);
objProperties.push(objPropertiesOutput);
});
return arrProperties;
}TypeScriptInterface: DropdownBoxValue
export interface DropdownBoxValue {
key: string;
value: string;
description: string;
}TypeScriptDiscover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
