+ Start a Discussion
Jeff@TargetX-chgJeff@TargetX-chg 

Parent-Child controller

I need to create a Visualforce page/form that collects information to be distributed across multiple objects, including custom objects. It is basically a form that gives the user a one-stop place to enter information that they have on paper right now. I created a controller that includes the Contact and Account object. However, I have 2 custom objects, Application and Family Relationships, that are children of the Contact object.
How do I add that to my controller so I can have access to the custom objects. My controller looks like this so far:
----------
public class LCADAppController {
    Account account;
    Contact contact;
   
    Public Contact getContact () {
        if(contact == null) contact = new Contact();
        return contact;
    }
   
    Public Account getAccount () {
        if(account == null) account = new Account();
        return account;
    }
    
    Public PageReference save() {
        insert account;
        contact.accountId = account.id;
        insert contact;
        return null;
    }
}
------
Any ideas of how to add the custom children objects to this controller? Or should I look at doing this a different way?
Thanks