function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Brian Cherry FWIBrian Cherry FWI 

SelectOptions not showing

I have a lookup field and a extenstion to convert the lookup as a select list. Debug log is showing options, but the VF page is not... Any ideas of why the select options aren't populating? 
 
public class BIWorkOrder {
    public Work_Order__c wo {get; set;}  
    public list<Deployment_Cycle__c> Deployments {get;set;}
    public List<SelectOption> options {get; set;}
    public BiWorkOrder(ApexPages.StandardController stdcontroller)
    {
        this.wo = (Work_Order__c)stdcontroller.getRecord();
        getItems();

    }
     public List<SelectOption> getItems() {
        Deployments = [SELECT ID, Deployment_Date__c from Deployment_cycle__c where Deployment_Date__c > :system.Today() and Active__c = true order By Deployment_date__c ASC];
        list<selectOption> options = new List<selectOption>(); 
        for(Deployment_Cycle__c d :deployments)
        {
           string newDate = d.Deployment_date__c.month() + '/' + d.deployment_date__c.day() + '/' + d.deployment_date__c.year();
           options.add(new selectOption (d.id, newDate));
        }
         system.debug(options);
 return options;
         
    }
}
 
<apex:pageBlockSection title="BI Fields" columns="2">
                <apex:inputField value="{!Work_Order__c.Resource__c}" required="false"/>
                <apex:selectList value="{!Work_Order__c.Deployment_Cycle__c}" > ---> Lookup field
                <apex:selectOptions value="{!Options}"></apex:selectOptions>  ---> Options 
                </apex:selectList>
                <apex:inputField value="{!Work_Order__c.Due_Date__c}" required="false"/>
                <apex:inputField value="{!Work_Order__c.Notes__c}" required="false"/>
                <apex:inputField value="{!Work_Order__c.Date_Complete__c}" required="false"/>
                         
            </apex:pageBlockSection>
Debug:

16:48:39:015 USER_DEBUG [20]|DEBUG|(System.SelectOption[value="aBv1b00000000EiCAI", label="2/3/2017", disabled="false"])
 
Best Answer chosen by Brian Cherry FWI
FearNoneFearNone
syntax error?
 
<apex:selectOptions value="{!Items}"></apex:selectOptions>
or
public List<SelectOption> getItems() {
    Deployments = [SELECT ID, Deployment_Date__c from Deployment_cycle__c where Deployment_Date__c > :system.Today() and Active__c = true order By Deployment_date__c ASC];
    options = new List<selectOption>(); 
    for(Deployment_Cycle__c d :deployments)
    ....

you saved the list in LOCAL-options and not in the global-options

All Answers

FearNoneFearNone
syntax error?
 
<apex:selectOptions value="{!Items}"></apex:selectOptions>
or
public List<SelectOption> getItems() {
    Deployments = [SELECT ID, Deployment_Date__c from Deployment_cycle__c where Deployment_Date__c > :system.Today() and Active__c = true order By Deployment_date__c ASC];
    options = new List<selectOption>(); 
    for(Deployment_Cycle__c d :deployments)
    ....

you saved the list in LOCAL-options and not in the global-options
This was selected as the best answer
Brian Cherry FWIBrian Cherry FWI
Great! Thanks, what a silly mistake.