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
Sree_1678Sree_1678 

Creating multiple records using date as variable

I have a requirement where multiple records needs to be created.

 

I want to use this under opportunity line items. like when a user clicks on a custom button it should open a page where it will ask for product name, quantity, price, from date and to date. once user enter all the information it should create N number of records based on the dates provided

 

For example if user enters From Date - 1/1/2012  and to Date - 5/1/2012, 5 records have to be created.

 

Thanks,

Big VBig V

try this in the controller

 

public class controller

{

.........

.........

date fromdate{get;set;}

date todate{get;set;}

public void createrecords()

{

for( i=0 ; i< fromdate.daysbetween(todate);i++)

{

......................

.....................

//Create and insert records

...................

....................

}

}

}