You would have to modify the opportunity query in the constructor to query the fields you want to add, then add a save function
Example modification to the constructorpublic SalesCoachControllerV2() {
String ID = ApexPages.currentPage().getParameters().get('id');
try{
this.oppty = [select
id,
name,
StageName,
forecastcategory,
CloseDate,
Term__c, ---------add whatever Other Custom fields you want
Then put them in the vf page.
And to create your own save button, add a button within vf and add this logic
<apex:commandbutton action="{!Save}" value="save"/>public pagereference Save(){
try{
oppty.stagename = opportunityStage;
update oppty;
PageReference opptyPage = new ApexPages.StandardController(oppty).view();
opptyPage.setRedirect(true);
return opptyPage;
}catch(exception e){
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'An error occured while updating: '+e.getmessage()));
return null;
}
}
Good Luck!
4 risposte