You need to sign in to do that
Don't have an account?

Multiple Object Record Creation on a Single Page?
Hello. I have been trying to figure out if there is a simple way in VF that provides the ability for the end user to create multiple new records of a specific custom object on one single page.
The below example lists my code that creates a single "Customer__c" record (three fields on a single line). My goal here is to figure out if there is a simple way to be able to enter 5 to 10 new "Customer__c" records on the same page...and just click the "save" button once to save all of the records.
Does anyone know if this is possible...and, if so, could provide some guidance?
Thanks in advance. Below is my code for the single record entry.
<apex:page standardController="Customer__c" recordSetVar="cust" showheader="false">
<apex:form >
<apex:pageBlock title="Add New Customer">
<apex:pageBlockSection columns="3">
<apex:inputField value="{!Customer__c.name}"/>
<apex:inputField value="{!Customer__c.Region__c}"/>
<apex:inputField value="{!Customer__c.Tier__c}"/>
</apex:pageBlockSection>
<apex:commandButton action="{!save}" value="Save"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Hi bozotheclown , You can do that.
Here it is..
cheers,
Raghu
Raghu-
Thanks for the help. Unfortunately, I am running into an error with the controller code you recommended. The "insert customers;" line in the controller is triggering the error message "Compile Error: Non-void method might not return a value or might have statement after a return statement."
Any thoughts on why this is happening? Thanks again for the help.
Try This ...
public PageReference save(){
insert customers;
return null;
}
I appreciate the help with this - but unfortunately I am still experiencing some issues.
First, the page displays with the two buttons - but the fields are not visible. When I click the "add row" button, I receive an error message saying. "Could not resolve the entity from <apex:inputField> value binding '{!a.name}'. inputField can only be used with SObject fields".
Any thoughts on why this is happening? Thanks again for the help.
Hey
Sorry. Try this code. Its working..
Cheers,
Raghu
Perfect. Thanks so much for the help.