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
nyanginyangi 

Populating Multiple Record with Single Date Value

How does one define a Date Value to populate multiple Records on a VF Page?

Avidev9Avidev9
Can you elaborate a lil ?
may be a sample code ?
nyanginyangi

I dont have Sample Code Im afraid. But basically, this is a VF Page that allows one to create multiple records that have Date as one of the value. However, I want the user to select a single date value placed on top of the page as the Date matching the records he's creating. On clicking save all mass records saved should have this date value. Essentially I want to improve the UX by limiting the number of clicks one has to do to input a date value on mass records.

 

Hope this helps.

 

Thanks

 

Avidev9Avidev9
well if you are looking for possibility, the answer is definitely yes!
You can assign the selected date to every record in List of records.

It should be pretty str8 forward
nyanginyangi

Im new to Apex Controllers and VF. Do you have some sample code to start me off?

Avidev9Avidev9

Sample ??

 

Ok here is a sample to show Account records in a VF page.

 

public class AccDemo_Con {
    /*List of wrappers*/
    public List < Account > accountList {
        get;
        set;
    }
    /*Constructor*/
    public AccDemo_Con() {
        accountList = getData();
    }
   
    private List < Account > getData() {
       
        return [SELECT Name, Id, Phone, Description FROM Account];
    }
   
}

 

 

<apex:page controller="AccDemo_Con">  
   <apex:sectionHeader title="Demo"/>  
   <apex:Form >  
     <apex:pageBlock title="Demo">  
       <apex:pageBlockTable value="{!accountList}" var="acc">  
         <apex:column value="{!acc.name}"/>  
         <apex:column value="{!acc.phone}"/>  
       </apex:pageBlockTable>  
     </apex:pageBlock>  
   </apex:Form>  
  </apex:page> 

 This is a adapted code from my blog http://blogforce9.blogspot.in/2013/06/wrapper-classes-wrap-it-up-with-wrapper.html