+ Start a Discussion
Hemalatha  ParuchuriHemalatha Paruchuri 

i am over ride standard opportunity page with custom fields in vf page and i take a related list quote .and a take another section take products .now what my scenerio is when ever i create new quote opportunity products automatically selected quote line

Its my code,
<apex:page standardController="opportunity" extensions="Testopportunitysaveoverridecls" >
<apex:form >
<apex:pageBlock mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!Edit}"/>
<apex:commandButton value="Delete" action="{!Delete}"/>

</apex:pageBlockButtons>
<apex:pageblock title="My Content">
<apex:pageblockSection title="Opportunity Information">
<apex:outputField value="{!Opportunity.ownerId}"/>
<apex:outputField value="{!opportunity.AccountId}"/>
<apex:outputField value="{!opportunity.Name}"/>
<apex:outputField value="{!opportunity.Stagename}"/>
<apex:outputField value="{!opportunity.closedate}"/>
</apex:pageblockSection>
</apex:pageblock>
<apex:pageblocksection title="Select Products">
<apex:outputfield value="{!Opportunity.Room__c}"/>
<apex:outputfield value="{!Opportunity.Total_In_Units__c}"/>
<apex:outputfield value="{!Opportunity.Product__c }"/>
<apex:outputfield value="{!Opportunity.Product__r.UOM__c}"/>
<apex:outputfield value="{!Opportunity.Length__c}"/>
<apex:outputfield value="{!Opportunity.Width__c}"/>
<apex:outputfield value="{!Opportunity.Quantity__c}"/>
<apex:outputfield value="{!Opportunity.Product__r.Cleaning_cost__c}"/>
<apex:outputfield value="{!Opportunity.Product__r.FS_Cost__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:relatedList list="Quotes"/>
</apex:page>



 THIS controller
public with sharing class Testopportunitysaveoverridecls
{

private ApexPages.StandardController sc;
    public Testopportunitysaveoverridecls(ApexPages.StandardController sc) {

        this.sc = sc;
    }
    public PageReference save() {
    
        PageReference detailPage = sc.edit();
        if (detailPage != null) {
            // Construct URL of edit page or whatever other page you want
            PageReference editPage = new PageReference('/apex/TestOpportunity');
            return editPage;
        } else {
            return detailPage;
        }
}
}