I am trying to create visualforce page similar to workflow page(See attached image). I have 3 columns 1st is Field Name 2nd operator 3rd Value
I want value field as input type picklist if 1st column i.e Field name is of type picklist.
i.e if I am selecting field status Value should show picklists available in status field as picklist
Visualforce :
<apex:pageBlockSection title="Rule Criteria">
<apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
<apex:column headerValue="Ident">
<apex:outputText value="{!wrapper.ident}"/>
</apex:column>
<apex:column headerValue="Field">
<apex:selectList value="{!wrapper.acc.WFCField__c}" size="1">
<apex:selectOptions value="{!FieldSeletOptions}"/>
</apex:selectList>
</apex:column>
<apex:column headerValue="Operator">
<apex:inputField value="{!wrapper.acc.WFC_Operator__c}"/>
</apex:column>
<apex:column headerValue="Value">
<apex:inputField value="{!wrapper.acc.WFCField__c}"/>
</apex:column>
<!--
<apex:column headerValue="Action">
<apex:commandButton value="Delete" action="{!delWrapper}"
rerender="wtable">
<apex:param name="toDelIdent" value="{!wrapper.ident}"
assignTo="{!toDelIdent}"/>
</apex:commandButton>
</apex:column>
-->
</apex:pageBlockTable>
</apex:pageBlockSection>
Code in controller get SelectOpions for field column:
public List<SelectOption> getFieldSeletOptions() {
List<SelectOption> fieldOptions = new List<SelectOption>();
String type='Case';
Map<String, Schema.SObjectType> schemaMap =
Schema.getGlobalDescribe();
Schema.SObjectType caseSchema = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap =
caseSchema.getDescribe().fields.getMap();
SelectOption optionNone = new SelectOption('', '--None--');
fieldOptions.add(optionNone);
for (String fieldName: fieldMap.keySet()) {
System.debug('##Field API Name='+fieldName);// list of all field API name
//It provides to get the object fields label.
Schema.DisplayType fieldType =
fieldMap.get(fieldName).getDescribe().getType();
if(fieldType != Schema.DisplayType.ID) {
SelectOption option = new SelectOption(fieldName,
fieldMap.get(fieldName).getDescribe().getLabel());
fieldOptions.add(option);
}
}
return fieldOptions;
}
Wrapper
public class WFCriteriaWrapper {
public WFCriteria__c acc { get; private set; }
public Integer ident { get; private set; }
public WFCriteriaWrapper(Integer inIdent) {
ident=inIdent;
acc=new WFCriteria__c();
}
}
Field column is nothing but fields on case. email Address is of type text so value should be of input type text. If I am selecting Status field which is Picklist on Case, then on Value column next to Status I want it as Picklist values of status.I should be able to select a picklist