here is my page block table:

<apex:pageblock title="RRD Approved Start and Complete Dates">
<apex:pageblockTable value="{!scheduleEmailLinkWrapperList}" var="d">
<apex:column headerValue="Milestone Complete Dates">
<apex:outputText value="{!d.milestone}"/>
<apex:column headerValue="Approved Start">
<apex:inputField value="{!d.promotion.CustomerDeliveryDate__c}"/>   
<apex:column headerValue=" Approved Complete">
<apex:inputField value="{!d.promotion.ProdFinishDueActualCompletePriorValue__c}"/>

here is my wrapper class in the controller:

public class ScheduleEmailLinkWrapper {
 // constructor for approval dates table
 public string milestone{get;set;} 
 public Promotion__c promotion{get;set;}
public ScheduleEmailLinkWrapper(string milestone, Promotion__c promotion) {
    this.milestone = milestone;

On initialization of my controller, I am getting the promotion ID from the page parameters and querying the promotion with the ID and sending it to fill my wrapper class list. here is the code which does that:

 List<string> milestoneCollection = new List<string>{'Creative','Estimating','Artwork Due','Proof Approved','Production/Finishing','Kitting','Shipping','Invoicing'};
if(ApexPages.currentPage().getParameters().get('id')!=null) {
        Id promotionId = ApexPages.currentPage().getParameters().get('id');
        promo = [select id,name,CustomerDeliveryDate__c,ProdFinishDueActualCompletePriorValue__c from Promotion__c where id = :promotionId];
          promo.CustomerDeliveryDate__c = null;
          promo.ProdFinishDueActualCompletePriorValue__c = null;
    scheduleEmailLinkWrapperList = new List<ScheduleEmailLinkWrapper>();
    for(string milestone : milestoneCollection) {
        ScheduleEmailLinkWrapper scheduleEmailLinkWrapper = new ScheduleEmailLinkWrapper(milestone, promo);

The reason I am using the !d.promotion.CustomerDeliveryDate__c and !d.promotion.ProdFinishDueActualCompletePriorValue__c in my page as values because I just want to use the dummy dates so that I could get the calendar in my input field.

I have a calculate dates button when clicked, I have to update the invoicing row Approved Start Date. so on click of calculate button I have this:

public void calculateDates() {      
for(ScheduleEmailLinkWrapper scheduleEmail : scheduleEmailLinkWrapperList) {
     if(scheduleEmail.milestone=='Invoicing') {
      scheduleEmail.promo.CustomerDeliveryDate__c= custDeliveryDate;


This updates all the Approved Start Dates for all the rows rather than just the invoicing row Approved Start Date. How do I make sure it just updates the invoicing row alone??

  • Can you mark as solved or update your question so it does not keep getting bumped?
    – Eric
    Commented Mar 7, 2015 at 21:37

1 Answer 1


You code does not seem to match up with your description.....The variable / property names are different as you do not show where promo or custDeliveryDate are defined

Since you are using dummy fields you just need to set the values from the wrapper. The following framework may help:


public class vfClass{

  public wrapper[] w {get;set;}

  public vfClass(){

     w = New Wrapper[]{New Wrapper('Test')};


  public void save(){
      Account[] aList = New Account[]{};
      for(Wrapper indv_w : w){
           //Copy inputed date to the account - Assuming The desired object does not have a date field to use for the dummy field
           indv_w.a.DATEFIELD = indv_w.c.DATEFIELD;
       upsert a;

   public class wrapper{
     public Account a {get;set;}
     Public Contact c {get;set;}

     public wrapper(String nm){
        a = New Account(Name = nm);
        c = New Contact();


VF Page

<apex:commandButton action="{!save}" value="Click Me" rerender="msgs"/>
<apex:pageblock title="RRD Approved Start and Complete Dates">
<apex:pageblockTable value="{!w}" var="d">
<apex:column headerValue="Approved Start">
<apex:inputField value="{!d.c.DATEFIELD}"/>   

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .