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
Bryan TelfordBryan Telford 

Pre-populated data in VF page using Apex controller

I am creating an applicant tracking system. I have an input page where the user can provide the applicant details.

The parent object is an "applicant" and there are some child objects. One of those child objects is "equipment". On the input page, I need up to 5 rows pre-populated with different data for the equipment object. Each row will be one record. The problem is the records aren't created yet, but I want to pre-fill values because most of the time it's not going to change. The user should be able to remove 1 or more rows. When the user submits the rows still on the page will be saved as child records.

Is this feasible? I can write a for loop to insert multiple child objects, Does anyone have any tips to pre-populate the child rows? Below is a screen shot. Each row will correspond to one child record that would be created when the user submits the page.
User-added image
Bryan TelfordBryan Telford
Update: I know that I can use JavaScript, but it would nice to find an Apex solution.
YOGESH BISHT2YOGESH BISHT2
Hi Bryan,

You can create utilize custom setting for Equipment data. I am assuming you have limited equipment .

you can create field like Cost and Quantity and put these value against equipment name.  Use APex to fetch data from Custom Setting Record.

Thanks & Regards,

Yoegsh 
Bryan TelfordBryan Telford
That's perfect. I was just overthinking it. Thanks!