You need to sign in to do that
Don't have an account?
paddu
VF Page Help
Hi,
I'm struck to write a VF page to override Oppprtunity.Choose price book standard button. I need to show list of Pricebooks on my page based on profiles. Can any one help / give some idea how to overriede. Any help must be highly appreciated.
Thanks & Regards,
Hi
create a page
<apex:page standardController="Opportunity">
<apex:sectionHeader title="Pricebook" subtitle="yyy"/>
<apex:form >
<apex:pageBlock title="Choose Price Book for:">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
some other stuff
</apex:pageBlock>
</apex:form>
</apex:page>
Now Go to customize-->Opportunity-->Opportunity Products-->Button and Links--->
click on edit next to Choose pricebook button
select visualforce button
select visualforce page name that u created now .
click save .
Did this post answers your questions if so please mark it solved .
Thanks
asish
Thank you for your reply Asish.
So far i have created this. I'm able to show all the price books as a picklist and struck how to save pricebook along with selected pricebook. Any help is appreciated
Here is my code:
<apex:page standardController="Opportunity" extensions="PriceBookDemoController">
<apex:sectionHeader title="Price Book" subtitle="{!OppName}"/>
<apex:form >
<apex:pageBlock title="Choose Price Book for:">
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:panelGrid columns="3">
<apex:outputText value=" Price Book"/>
<apex:selectList id="status2" size="1" multiselect="false" >
<apex:selectOptions value="{!SelectBranchOptions}"/>
</apex:selectList>
</apex:panelGrid>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller class:
public class PriceBookDemoController {
public String OppName{set;get;}
Id OpportunityId;
public PriceBookDemoController(ApexPages.StandardController controller) {
OpportunityId = apexPages.currentPage().getParameters().get('id');
Opportunity Opp = [select Id,Name from Opportunity where id =: OpportunityId];
OppName = Opp.Name;
}
public List<SelectOption> getSelectBranchOptions() {
List<SelectOption> options = new List<SelectOption>();
for(pricebook2 pb:[select id,name from pricebook2 where isactive = true]) {
options.add(new SelectOption(pb.id,pb.name));
}
return options;
}
}
Best Regards,