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
Iqra TechIqra Tech 

i need to store the records in my custom object how can store the records on my custom object

i am having vf page and having 6 fields to select the fields are coming after selection of object then i have button called Query then according field selection we are getting selected object recrods then after this records i need to store in my cutom object how can i store can any one please help it it very urgent i and i am stuck on it..

please see below scrren shot of vf page with results 

User-added image
Mohit Bansal6Mohit Bansal6
Hi Iqra,
Once you have the list of record displayed in the results table, you can have a button called "Save to Custom Object". Once clicked, you can create the records using below sample:
 
List<CustomObject> lCustom = new List<CustomObject>();
For( List<ResultsTypes>  ac : Results List){
      CustomObject ob = new CustomObject();
      ob.name = ac.name;
      lCustom.add(ob);
}

insert lCustom;

Do share if you need any help or more guidance on it.

*Please mark it as "Best Answer" so that any more user can refer this sample code