12-02-2014 05:29 AM - edited 03-01-2019 06:31 AM
Tutorial on how to build a double selector (drop down) where one selection depends on another.
The goal is at execution time of a workflow to display something like this:
Step 1
In Policies -> Orchestration -> Custom Workflow Inputs create 2 variables like this:
The servers:
The Environment:
The result should look like this:
Create a workflow:
The workflow will have 2 input variables defined like this:
Here are the details on the server variable (Main point to note here is the Filter with CONTAINS variable):
Upon workflow execution the drop down will display the following:
Production:
Test:
Development
Other Filter Examples:
More Filter Examples:
Problem: The drop down has a Default Select... in it:
The filter to eliminate the problem:
The result:
Multi Select list by Mohamed Arif Hajamohideen:
This task will create the Multi-select List type LOV.
It will work with both workflow and task level.
Steps:
1. Execute the workflow ‘registerLOV’.
It will create the Multiselect LOV of Type ‘LOVLIST3TYPE’.
Please note that The LOV type ‘LOVLIST3TYPE’ will be created after executing this task
2. Create the custom task with the input field of type ‘LOVLIST3TYPE’.
Please refer the workflow ‘multiselect LOV workflow’
3. If you require workflow level input then add the workflow property of type LOVLIST3TYPE"
task which will create the Multi-select List type LOV.
It will work with both workflow and task level.
Filter by list of letters example (Presented by (Jeremy Guthrie (CDW))):
The CONTAINS parameter:
The list of letters custom variable:
Here is the register code that reads from CSV and created the LOV for multi select:
importPackage(com.cloupia.service.cIM.inframgr.customactions);
importPackage(com.cloupia.service.cIM.inframgr.forms.wizard);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.feature.powershellAgentController.wftasks);
importPackage(com.cloupia.lib.cIaaS.network.model);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.service.cIM.inframgr.workflowmgr);
importPackage(com.cloupia.service.cIM.inframgr.customactions);
importPackage(com.cloupia.service.cIM.inframgr.forms.wizard);
importPackage(com.cloupia.service.cIM.inframgr);
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.feature.customactions.lovproviders);
importPackage(java.util);
importPackage(java.io);
importPackage(com.cloupia.service.cIM.inframgr.forms.wizard);
function createLOV() {
var lov = new Array();
// lov[0] = new FormLOVPair(a, a);
// lov[1] = new FormLOVPair("two", "two");
// lov[2] = new FormLOVPair("three", "three");
// lov[3] = new FormLOVPair("four", "four");
// lov[4] = new FormLOVPair("five", "five");
// lov[5] = new FormLOVPair("five5", "five5");
var tokens;
for (var i=0;i<UCSD.length; i++)
{
logger.addInfo("UCSD content: "+UCSD[i]);
tokens = UCSD[i];
logger.addInfo("tokens : "+tokens);
logger.addInfo("tock.. 0: "+tokens[0]);
logger.addInfo("tock.. 1: "+tokens[1]);
lov[i] = new FormLOVPair(tokens[0], tokens[1]);
}
return lov;
}
logger.addInfo("Read File /tmp/info4.csv.........");
var fileReader = new FileReader("/tmp/info4.csv");
var br = new BufferedReader(fileReader);
var tokens;
var UCSD = new ArrayList();
var lov = new Array();
logger.addInfo("before loop.........");
var i=0;
while(true){
var line = br.readLine();
if(line == null)break;
logger.addInfo("Line" + line);
tokens = line.split(",");
// lov[i] = new FormLOVPair(tokens[0], tokens[1]);
logger.addInfo("tock 0: "+tokens[0]);
logger.addInfo("tock 1: "+tokens[1]);
i=i+1;
if(tokens != null && tokens.length > 0){
UCSD.add(tokens);
}
}
br.close();
logger.addInfo("tokens.length: "+tokens.length);
logger.addInfo("UCSD Length: "+UCSD.length);
var tokens;
for (var i=0;i<UCSD.length; i++)
{
logger.addInfo("UCSD content: "+UCSD[i]);
tokens = UCSD[i];
logger.addInfo("tokens : "+tokens);
logger.addInfo("tock.. 0: "+tokens[0]);
logger.addInfo("tock.. 1: "+tokens[1]);
}
var lovRegistry = LOVProviderRegistry.getInstance();
var dataProvider = new com.cloupia.service.cIM.inframgr.forms.wizard.LOVProviderIf({
getLOVs : function(session) {
return createLOV();
}
});
lovRegistry.registerProvider("LOVLIST5", dataProvider);
var registry = CustomFeatureRegistry.getInstance();
registry.registerWorkflowInputFieldType("LOVLIST5TYPE", "LOV List5", FormFieldDefinition.FIELD_TYPE_MULTI_SELECT_LIST, "LOVLIST5");
logger.addInfo("successfully registered LOVLIST5TYPE with name LOV LIST5 and made it available as a global workflow input with type LOVLIST5TYPE");
Great example of documenting a workflow
Thanks Orf.
The custom LOV only allow user to select 1 entry from custom list.
Is there any way to select multiple values?
I was thinking to use custom LOV to get list of values, then use it in loop in workflow.
I do not see the "Input Filter Criteria" in my test. I am using version 6.
I just imported the double LOV example into my UCSD 6.5 set up and it works:
I am wondering how your variable is set up? Or how does it differs from this example?
Here is the inputs:
Here is the workflow inputs. As shown, I do not see the input criteria under admin input.
-Shawn
Hi Shawn,
Please see the below screenshots. You need to select 'Admin Input Filter' checkbox than 'Admin Input' checkbox.
Thanks,
Phani
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: