You need to sign in to do that
Don't have an account?
Building Page to Insert Multiple Contacts
I would like to build a Visualforce page where my users can go and insert multiple Contacts in one shot. It would basically act like an Excel sheet with columns like First Name, Last Name, Email, etc. Once they enter all of their Contacts, they would click a button, all Contacts would be inserted.
A good scenario would be collecting 20 business cards from a fair. When you get back from the fair you can enter the information from the 20 cards at once, without clicking 'New' 20 individual times. After the data is entered, click 'Insert' and you just created 20 Contacts.
Does anyone know if creating repeating records/fields is possible?
Thanks,
Jeff
You can do this by creating an array of new contacts in your controller and using a repeater to display each contacts information. A basic example is below.
I hope that helps get you started
Victor
Controller : Change private Integer noOfContacts = 20; number as your req
VFP :
Step 1 : Create field set with name "MultipleContact" on contact object, add field that you want on screen in "In the Field Set" , For creating field set : Customize -> Contact -> Field Sets
read this for field sets : http://forceschool.blogspot.com/2011/06/dynamic-binding-using-field-sets.html
Your are all set to get input for multiple contacts.
That is awesome. Thanks for your help.
One step further...is there a way to make the number of Contacts a variable? The one issue is that if I specify 20 Contacts but there are really only 15, you will get an error because all of the Last Name fields are required.
It would be nice to either pass the number of Contacts as a variable and/or include a button to add another row. Is this possible?
Thanks,
Jeff
in the button, do Immediate="true", which bypasses the initial validation.
I realize this was over a year ago...but I copied this code and it looks great. However, I have no idea how to create a button that goes to the multiplecontacts page. Nowhere on any object does it allow me to override with this page. I've only ever used standard controllers. Advice?
I have a custom object called Households__c, and I want to create a button that goes to this page that allows for entering multiole contacts. And I want to autpopulate the Household_ID__c field on the contact page.
Any help would be great.
Thanks!