You need to sign in to do that
Don't have an account?
Luik Lara
Visualforce Button directing to wrong page
Hello!
I have been trying to solve this for ages and can not figure it out (I am not a developer).
I modified someone else's code to build a visualforce page to show product revenue schedules (above). Instead of the 'Edit Schedule' button, I am trying to show that smaller down carrot icon that reps can select to then click 'edit'. In addition, the current button shows the edit product page instead of the edit revenue schedule page. Can someone please advise?
Here is the code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!lstOLIS}" var="lst" >
<apex:column headerValue="Product" value="{!lst.Product_Name2__c}"/>
<apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
<apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
<apex:column ><apex:commandButton action="{!edit}" value="Edit Schedule" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Extension:
public with sharing class OpportunityScheduleExtension {
Opportunity objOpp;
public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
public OpportunityScheduleExtension(ApexPages.StandardController controller) {
this.objOpp= (Opportunity)controller.getRecord();
}
public void getOLIS(){
lstOLIS = new list<OpportunityLineItemSchedule >();
system.debug('objOpp---------->'+objOpp);
for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
OpportunityLineItem.Product2.Name,
Description,Product_Name2__c
from OpportunityLineItemSchedule
where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
lstOLIS.add(objOLIS);
}
}
}
I have been trying to solve this for ages and can not figure it out (I am not a developer).
I modified someone else's code to build a visualforce page to show product revenue schedules (above). Instead of the 'Edit Schedule' button, I am trying to show that smaller down carrot icon that reps can select to then click 'edit'. In addition, the current button shows the edit product page instead of the edit revenue schedule page. Can someone please advise?
Here is the code:
<apex:page standardController="Opportunity" action="{!getOLIS}" tabStyle="Opportunity" extensions="OpportunityScheduleExtension" lightningStylesheets="true">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!lstOLIS}" var="lst" >
<apex:column headerValue="Product" value="{!lst.Product_Name2__c}"/>
<apex:column headerValue="Date" value="{!lst.ScheduleDate}"/>
<apex:column headerValue="Revenue" value="{!lst.Revenue}"/>
<apex:column ><apex:commandButton action="{!edit}" value="Edit Schedule" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Extension:
public with sharing class OpportunityScheduleExtension {
Opportunity objOpp;
public list<OpportunityLineItemSchedule> lstOLIS {get;set;}
public OpportunityScheduleExtension(ApexPages.StandardController controller) {
this.objOpp= (Opportunity)controller.getRecord();
}
public void getOLIS(){
lstOLIS = new list<OpportunityLineItemSchedule >();
system.debug('objOpp---------->'+objOpp);
for(OpportunityLineItemSchedule objOLIS:[Select Id, ScheduleDate, Revenue,
OpportunityLineItem.Product2.Name,
Description,Product_Name2__c
from OpportunityLineItemSchedule
where OpportunityLineItem.OpportunityId =:objOpp.Id] ){
lstOLIS.add(objOLIS);
}
}
}
According to my understanding you would like to have an icon on the button instead of the edit schedule can you try changing the below code from :
<apex:column ><apex:commandButton action="{!edit}" value="Edit Schedule" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
to:
<apex:column ><apex:commandButton action="{!edit}" iconName="edit" id="OpportunityLineItemScheduleMultiEdit"/></apex:column>
Can you please check this once. In case if this helped can you please choose this as the best answer so that it can be used by others in the future.
Regards,
Anutej
Thanks so much for your help! The button worked however, it is still taking me to the wrong page. It is meant to take me to the Line Item Schedule Edit area but it is taking me to the product editing area. Any ideas?
Thanks!!
Also can you try if giving the "product editing area" in the code does the button redirect to "Schedule Edit area"