You need to sign in to do that
Don't have an account?

In-Line Editing Custom Object List
Hi Everyone,
In a nut shell, what I am trying to accomplish is to display a list of records (Employees) on a visualforce page which is similar to this Opportunities Example - Editing Records with List Controllers. When the user makes edits to the picklist values, they will click Save and that will then update all of the records with their changes.
That being said, listed below is my visualforce page and apex class.
VF Page
<apex:page Controller="TMEvaluationClass" tabStyle="Account" sidebar="false" showHeader="false"> <apex:form > <apex:pageBlock > <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!Employees}" var="emp"> <apex:column headerValue="Account"> <apex:outputField value="{!emp.Account__c}"/> </apex:column> <apex:column headerValue="Employee ID"> <apex:outputField value="{!emp.EMP_ID__c}"/> </apex:column> <apex:column headerValue="Hire Date"> <apex:outputField value="{!emp.HIRE_DATE__c}"/> </apex:column> <apex:column headerValue="Tenure"> <apex:outputField value="{!emp.Tenure__c}"/> </apex:column> <apex:column value="{!emp.name}"/> <apex:column headerValue="Quality"> <apex:inputField value="{!emp.Q2_Quality_Rating__c}"/> </apex:column> <apex:column headerValue="Customer Satisfaction"> <apex:inputField value="{!emp.Q2_Customer_Sat_Rating__c}"/> </apex:column> <apex:column headerValue="Score"> <apex:inputField value="{!emp.Q2_2013_TM_Eval_Score__c}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Class
public class TMEvaluationClass { public TMEvaluationClass() { } //Get Employees public List<Employee__c> getEmployees() { List<Employee__c> Employees = new List<Employee__c>(); Employees = [select ID, name, SS__c, Active__c, Account__c, EMP_ID__c, Hire_Date__c, Tenure__c, Q2_Customer_Sat_Rating__c, Q2_Quality_Rating__c, Q2_2013_TM_Eval_Score__c FROM Employee__c WHERE Active__c = TRUE]; return Employees; } //Save / Update Employee Object Records public PageReference save() { /* try { update Employees; Employees = null; } catch (Exception e) { ApexPages.addMessages(e); } */ return null; } }
Currently the visualforce page is working as expected, displaying the list with all of the picklist fields that are editable but I am having trouble writing the save method in a way that will update the records rather than insert new ones. Any advice assistance would be greatly appreciated, thank you for your time!
dblaze,
I don't see anything obviously wrong. Does your "save" method actually create new records rather than update existing ones?
Ram