You need to sign in to do that
Don't have an account?
Ashh.cloud
To display set of records from a custom object on a Visualforce page and save them to a different custom object.
Hi there,
I have a requirement in which I have to display a set of records of a custom object on a visualforce page. Detailed explanation below.
Any help is appreciated.
Thank you
I have a requirement in which I have to display a set of records of a custom object on a visualforce page. Detailed explanation below.
- I have two custom objects OBJECT1 and OBJECT2,
- I need a visualforce page for Object2 which should give me a set of records of Object1 based upon some filtering condition (which is dynamic).
- I should be able to select a few records from the results displayed and I should save some of them into Object2
Any help is appreciated.
Thank you
1. Create a visualforce for Object 2 using custom controller.
2. Create a datatable in this visualforce to display the records that belong to object 1. You need to have the value of datatable call a wrapper class method where you will be querying for object 1 records and assign a checkbox to each and every record. http://wiki.developerforce.com/page/Wrapper_Class
3. Get the selected records of object 1 into a list object in the controller and create new object 2 records based on the data of object 1 records.
The following articles help you to understand about wrapper classes with example codes that you can leverage as per your need
http://blog.jeffdouglas.com/2009/01/13/apex-search-with-checkbox-results/
http://mycloudexperience.blogspot.in/2011/03/adding-checkbox-on-pageblocktable.html
Hope this helps you to start up.
All Answers
1. Create a visualforce for Object 2 using custom controller.
2. Create a datatable in this visualforce to display the records that belong to object 1. You need to have the value of datatable call a wrapper class method where you will be querying for object 1 records and assign a checkbox to each and every record. http://wiki.developerforce.com/page/Wrapper_Class
3. Get the selected records of object 1 into a list object in the controller and create new object 2 records based on the data of object 1 records.
The following articles help you to understand about wrapper classes with example codes that you can leverage as per your need
http://blog.jeffdouglas.com/2009/01/13/apex-search-with-checkbox-results/
http://mycloudexperience.blogspot.in/2011/03/adding-checkbox-on-pageblocktable.html
Hope this helps you to start up.