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
gulfkltogulfklto 

insert multiple related objects

Hello everybody,

I'm trying to add multiple related objects on a visualforce page. I've followed the example given in the visualforce manual that allows you to create an account, contact, and opportunity from a single page using a wizard.

 

On my wizard I have the need to add multiple contacts to the object I'm creating (a visit report) , can You help me?

 

thanks

 

 

Best Answer chosen by Admin (Salesforce Developers) 
CarlKingCarlKing
I had come to the same conclusion, but figured I was wrong. It goes against all that I have learned for programming. Thank you for the help.

All Answers

CarlKingCarlKing

Hello All,

I am having the same issue. I have a custom form that i am using in house. I need to be able to add multiple contacts to a newly created account. Any ideas?

gulfkltogulfklto

I did it in a way that I don't like very much... In the custom controller I've created 4 objects related to the contact

so I can add up to 4 related contacts while I'm creating the new object.

 

In the code should be something like this:

 

Contact contact;
Contact ontact2;
Contact ontact3;
Contact ontact4;

 

CarlKingCarlKing
I had come to the same conclusion, but figured I was wrong. It goes against all that I have learned for programming. Thank you for the help.
This was selected as the best answer