You need to sign in to do that
Don't have an account?
JoeyD
Redirect to parent record when saving child record...
I've added the following extension to a visualforce page. The page's object is a child of Opportunities. After saving a record in this child object, I'd like to be redirected back to the parent record.
I don't know how to get the parent Opportunity record ID to reference in the PageReference method.
(I know my custom object is called TestParent... this is because it is actually the parent of another custom object, TestChild. :smileytongue: )
public class testParentSave {
public TestParent__c parent {get; set;}
public testParentSave(ApexPages.StandardController controller) {
parent = (TestParent__c) controller.getRecord();
}
public PageReference save() {
insert parent;
PageReference pr = new PageReference('/'+TestParent__c.Opportunity__c);
pr.setRedirect(true);
return pr;
}
}
No one knows?
I've started in on the Apex Code Developer's Guide, but haven't across this yet...