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
pramod sharma 15pramod sharma 15 

how to bind the picklist value selected from dynamic picklist

Question: How to bind the value selected from dynamic picklist onto controller. (I'm passing on session date 

In the below code snippet, user selects an session picklist value. Now I want to retrieve the complete session record based on selection. But when I try to assign the 'session' to an Sobject coaching__C, it is saying that its an invalid assignement of string to Sobject. How to use the selected picklist to bind/retrieve the selected session record?

Code Snippet:
public String Session {get;set;}
    public List<SelectOption> getsessionoptions() 
         List<SelectOption> optionsz =  new List<SelectOption>();  
         list<coaching__C> archive = new list<coaching__c>();    
     archive = [select id,Coaching_Date__c,Coaching_Notes__c,Contact__c from Coaching__c where User__c = :UserInfo.getUserID() and Contact__c = :Subordinate]; 
        for(coaching__c f:archive) {optionsz.add(new system.selectoption(,string.valueof(f.Coaching_Date__c) ));}    
         return Optionsz;