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
Venkat Reddy sfdVenkat Reddy sfd 

Problem with Apex class..


i have problem with my apex class.. iam unable get the Fieldnames like(In Brand object Name of the Brand field).. i have 4 custom objects . that 4 custom objects one field(Name field) i have to display in the pick list and i have to give field dependence. for field dependency it will work above VF code.i am  unable get that object fields. problem with my class. can u please look in to that. 

Thanks in advance....
 
public class objectController
{
    public Map <String, list<METADATA_Campaign__c>> CampMap = [select name from METADATA_Campaign__c];
    public Map<string, List<METADATA_Franchise__c>> FranMap =[select name from METADATA_Franchise__c];
    public Map<string, List<METADATA_Program__c>> ProgMap =[select name from METADATA_Program__c];
    public Map<string, List<METADATA_Brand__c>> BranMap =[select name from METADATA_Brand__c];

    public String franchise {get; set;}
    public String program {get; set;}
    public String campaign {get; set;}
    public String brand {get; set;}

    Public objectController()
    {   
        selectedObject = 'METADATA_Campaign__c';
    }

    public List<SelectOption> getcampaigns() 
    {
        List<SelectOption> campaignnames = new List<SelectOption>();
        List<String> entities = new List<String>(campMap.keySet());
        entities.sort();
        for(String name : entities)
        {
            campaignnames.add(new SelectOption(name,name));
        }
        return campaignnames;
     }
     
     Public objectController()
    {   
        selectedObject = 'METADATA_Franchise__c';
    }
     
    public List<SelectOption> getfranchise() 
    {
        List<SelectOption> franchisenames = new List<SelectOption>();
        List<String> entities = new List<String>(FranMap.keySet());
        entities.sort();
        for(String name : entities)
        {
            franchisenames.add(new SelectOption(name,name));
        }
        return franchisenames;
     }

 Public objectController()
    {   
        selectedObject = 'METADATA_Program__c';
    }
     
    public List<SelectOption> getProgram() 
    {
        List<SelectOption> Programnames = new List<SelectOption>();
        List<String> entities = new List<String>(ProgMap.keySet());
        entities.sort();
        for(String name : entities)
        {
            Programnames.add(new SelectOption(name,name));
        }
        return Programnames;
     }
     
      Public objectController()
    {   
        selectedObject = 'METADATA_Brand__c';
    }
     
    public List<SelectOption> getbrand() 
    {
        List<SelectOption> brandnames = new List<SelectOption>();
        List<String> entities = new List<String>(BranMap.keySet());
        entities.sort();
        for(String name : entities)
        {
            brandnames.add(new SelectOption(name,name));
        }
        return brandnames;
     }
 }

My VF Code...
 
<apex:page controller="objectController">
<apex:form > 
      <apex:pageBlock >
          <apex:pageBlockSection columns="4">

              <apex:pageBlockSectionItem >
                  <apex:outputlabel value="Franchise :"/> 
                      <apex:actionRegion >      
                           <apex:selectList value="{!Franchise}" size="1">
                                    <apex:selectOptions value="{!franchisenames}"/>
                                    <apex:actionSupport event="onchange" rerender="Brand"/>
                            </apex:selectList>
                     </apex:actionRegion>                         
              </apex:pageBlockSectionItem>
              
              
              <apex:pageBlockSectionItem >
                      <apex:outputlabel value="Brand :"/>   
                      <apex:outputPanel id="Brand">   
                        <apex:actionRegion >  
                           <apex:selectList value="{!Brand}" size="1" disabled="{!ISBLANK(Franchise)}">
                                <apex:selectOptions value="{!Brandnames}"/>
                               <apex:actionSupport event="onchange" rerender="Program"/>
                            </apex:selectList>
                        </apex:actionRegion>      
                     </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
                      <apex:outputlabel value="Program :"/>   
                      <apex:outputPanel id="Program">   
                        <apex:actionRegion >  
                           <apex:selectList value="{!Program}" size="1" disabled="{!ISBLANK(Brand)}">
                                <apex:selectOptions value="{!Programnames}"/>
                                 <apex:actionSupport event="onchange" rerender="Program"/>
                            </apex:selectList>
                        </apex:actionRegion>      
                     </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              
              <apex:pageBlockSectionItem >
                      <apex:outputlabel value="Campaign :"/>   
                      <apex:outputPanel id="Campaign">   
                        <apex:actionRegion >  
                           <apex:selectList value="{!Campaign}" size="1" disabled="{!ISBLANK(Program)}">
                                <apex:selectOptions value="{!Objectnames}"/>
                            </apex:selectList>
                        </apex:actionRegion>      
                     </apex:outputPanel>
              </apex:pageBlockSectionItem>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>