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
DFW DudeDFW Dude 

Using related list or standard page: calling new child Visual Force Page looses lookup relationship

I have these custom objects (Order, Line, Details) with parent lookups to another.
 
Using standard pages/controllers, when I click on say a new Line for an Order the lookup field on the Line to the Order will be pre-populated with the parent Order. (Works Good)
 
I have now created custom Visual Force Pages for these objects and have overridden the new,edit,view buttons on the objects to now reference the new VF pages.
 
I use a apex related list to show child items on some pages.  When I click on the new button to create the child ( say for a detail on a line) it will bring me to my new VF page, but will lose the relationship the parent Line.
 
I have the same problem when I come from a Standard page (like Opportunity) to create a custom VF Order page (Order has lookup to Oppty).
 
Do I need to make custom buttons with some type of S-Control to pass the info? Or can I get the info somehow from an extension of a Standard Controller?
 
Here is the code:
 
<apex:page standardController="NTTA_Line_Item__c"  extensions="lineEditController"  tabstyle="NTTA_Orders__tab">
<apex:stylesheet value="{!$Resource.Force_OM}"></apex:stylesheet>
<apex:sectionHeader title="Edit Line Item" subtitle="{!NTTA_Line_Item__c.Name}"></apex:sectionHeader>
<apex:form style="Force_OM.css" >
  <apex:pageBlock title="Edit Line Item" id="thePageBlock" >
  <apex:messages ></apex:messages>
  <apex:pageBlockButtons >
      <apex:commandButton value="Save" action="{!save}"></apex:commandButton>
      <apex:commandButton value="Delete" action="{!delete}"></apex:commandButton>
      <apex:commandButton value="Cancel" action="{!cancel}"></apex:commandButton>
  </apex:pageBlockButtons>
      <apex:actionRegion >
          <apex:pageBlockSection title="Basic Informtation" columns="1">
              <apex:inputField value="{!NTTA_Line_Item__c.NTTA_Order__c}"></apex:inputField>   
              <apex:inputField value="{!NTTA_Line_Item__c.NTTA_Product__c}"/>               
              <apex:inputField value="{!NTTA_Line_Item__c.Name}"></apex:inputField>
              <apex:inputField value="{!NTTA_Line_Item__c.Install_Location__c}"></apex:inputField>
              <apex:inputField value="{!NTTA_Line_Item__c.Quantity__c}"></apex:inputField>   
           </apex:pageBlockSection>
       </apex:actionRegion>
  </apex:pageBlock>
 </apex:form>
 
      <apex:pageBlock >
      <apex:pageBlockSection >   
           <apex:relatedList subject="{!NTTA_Line_Item__c}" list="NTTA_Line_Detail__r"></apex:relatedList>
       </apex:pageBlockSection>
     </apex:pageBlock>
 </apex:page>
 
Thanks