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
txmapptxmapp 

urgent help update field select list

hi

i have a problem i hope you can helpme

 

i have a custom button that send me to vf page

my custom object is Aspirante__c that has a select list with a list of status

i dont know how to pass the id of the record that  send me to the page, im actually link it by jscrip with onclick

 

my requirement is click button update status and show me the new page with a select list with the status permited

after select click on the button save or update 

 

but i can't pass the value to the controller , 

also i want to show differ values in the select list this depend of the actual status of the record else 

 

for example

New to On Hold
new to Rejected
Rejected to interview
interview to Rejected
interview to on hold
interview to offer
interest not to interview
not to offer interest
accepted offer to
accepted to hire

 

 

this is my code, that not run  show me this 

Id not specified in an update call
<apex:page standardController="Aspirante__c" extensions="SelectController">
     <apex:sectionHeader title="Estatus" />
     <apex:form >
     <apex:pageBlock title="Aspirante" mode="edit">
 
         <apex:outputText value="{!Aspirante__c.Estatus__c}" rendered="false"/>
         
 
          <apex:pageBlockButtons location="both">
               <apex:commandButton value="Save" action="{!save}" />
               <apex:commandButton value="Cancel" action="{!cancel}" />
          </apex:pageBlockButtons>
          <apex:pageMessages />       
 
          <apex:pageBlockSection title="Master Categories" columns="1">
 
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Estatus" for="cbxlevel1"/>
                    <apex:outputPanel styleClass="requiredInput" layout="block">
                    <apex:outputPanel styleClass="requiredBlock" layout="block"/>
                    <apex:selectList value="{!selectedLevel1}" id="cbxlevel1" size="1" required="true">
                        <apex:selectOptions value="{!level1items}"/>
                        <apex:actionSupport event="onchange" rerender="cbxlevel2"/>
                    </apex:selectList>
                    </apex:outputPanel>
                </apex:pageBlockSectionItem>
 
                
          </apex:pageBlockSection>
 
     </apex:pageBlock>
     </apex:form>   
 
</apex:page>
             

 

public class SelectController {
 
    // reference for the standard controller
    private ApexPages.StandardController controller {get; set;}
 
    // the record that is being edited
    private Aspirante__c opp;
 
    // the values of the selected items
    public string selectedLevel1 {get; set;}
 
 
    public List<selectOption> level1Items {
        get {
            List<selectOption> options = new List<selectOption>();
 
                options.add(new SelectOption('','-- Elige un Estatus --'));
                options.add(new SelectOption('Nuevo','Nuevo'));
                options.add(new SelectOption('En espera','En espera'));
                options.add(new SelectOption('Rechazado','Rechazado'));
                options.add(new SelectOption('Entrevista','Entrevista'));
                options.add(new SelectOption('No Interesado','No Interesado'));
                options.add(new SelectOption('Oferta','Oferta'));
                options.add(new SelectOption('Aceptado','Aceptado'));
                options.add(new SelectOption('Contratado','Contratado'));
                
 
            return options;           
        }
        set;
    }
 
  
   
 
    public MultiSelectController(ApexPages.StandardController controller) {
 
        //initialize the stanrdard controller
        this.controller = controller;
        // load the record
        this.opp = (Aspirante__c)controller.getRecord();
 
        // preselect the current values for the record
        selectedLevel1 = opp.Estatus__c;
     
 
    }          
 
    public PageReference save() {
 
        // set the selected values to the record before saving
        opp.Estatus__c =selectedLevel1;
       
        try {
            //upsert(opp);
            update(opp);
        } catch(System.DMLException e) {
            ApexPages.addMessages(e);
            return null;
        }
        return ( new ApexPages.StandardController(opp).view());
    }        
 
}

 

 

txmapptxmapp

i have solved my problem wih the id

 

only create the  new button and select source a vf page

 

can somebody help with the part

of show only the values that is permited

 

for example y actually the status is NEW on the select list values only i nedd to show me ONHOLD, REJECTED,INTERVIEW

I WANT THIS FUNCIONALITY ON THE CONTROLLER

I THINK MAKE DIFERENT LIST AND SHOWS DEPEND OF THE ACTUAL STATUS OF THE RECORD