Task Name | example of merging data from a loop into one varaible |
Description | |
Prerequisites | vCenter |
Category | Workflow |
Components | UCSD 6.6 |
User Inputs | |
Output | |
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFDX file resides. Choose the .WFDX file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.
A massive Thank You goes out to:
Andrews Bob for contributing this.
This is an example of merging output from a task that is in a loop into one variable.
The workflow:
![Screen Shot 2018-06-06 at 11.06.54 AM.png](/legacyfs/online/fusion/117413_Screen Shot 2018-06-06 at 11.06.54 AM.png)
E-mail output:
![Screen Shot 2018-06-06 at 11.50.36 AM.png](/legacyfs/online/fusion/117414_Screen Shot 2018-06-06 at 11.50.36 AM.png)
Workflow run:
![Screen Shot 2018-06-06 at 11.51.14 AM.png](/legacyfs/online/fusion/117415_Screen Shot 2018-06-06 at 11.51.14 AM.png)
Workflow input:
![Screen Shot 2018-06-06 at 11.06.45 AM.png](/legacyfs/online/fusion/117416_Screen Shot 2018-06-06 at 11.06.45 AM.png)
Log output:
![Screen Shot 2018-06-06 at 11.06.02 AM.png](/legacyfs/online/fusion/117417_Screen Shot 2018-06-06 at 11.06.02 AM.png)
Custom task input:
![Screen Shot 2018-06-06 at 11.51.44 AM.png](/legacyfs/online/fusion/117418_Screen Shot 2018-06-06 at 11.51.44 AM.png)
Output of custom task fed into input:
![Screen Shot 2018-06-06 at 11.51.53 AM.png](/legacyfs/online/fusion/117419_Screen Shot 2018-06-06 at 11.51.53 AM.png)
E-mail:
![Screen Shot 2018-06-06 at 11.52.11 AM.png](/legacyfs/online/fusion/117420_Screen Shot 2018-06-06 at 11.52.11 AM.png)
Custom task code:
function buildName(userInput, inputLength, prefix, suffix)
{
// Trim Length
if (inputLength > 0 && userInput.length() > inputLength)
{
userInput = userInput.slice(0,inputLength);
}
// Add prefix
if (prefix)
{
userInput = prefix + "\n" + userInput;
}
// Add suffix
if (suffix)
{
userInput = userInput + "\n" + suffix;
}
userInput = userInput + "\n";
return userInput;
}
// -- Begin --
var userInput = input.userInput;
var inputLength = input.inputLength;
var prefix = input.prefix;
var suffix = input.suffix;
logger.addInfo("userInput: " + userInput);
logger.addInfo("inputLength: " + inputLength);
logger.addInfo("prefix: " + prefix);
logger.addInfo("suffix: " + suffix);
if ( prefix.contains("${")) {
logger.addInfo("setting prefix to null since ${var} is not resolved")
prefix = "";
}
var mergedData = buildName(userInput, inputLength, prefix, suffix);
logger.addInfo("Merged Output: " + mergedData);
ctxt.setTaskStatusMessage("Merged Output: " + mergedData);
output.mergedOutput = mergedData;