I have an opportunity object ,with the related list as products.We do have different products with their sales price ,quantity ,list price etc.Now when i click on one of the product name ,it takes me to the product page.In that page we do have Schedule as a related list with their date column ,quantity etc.Now i would like to Dynamically populate the value of pricing request instead of date column.How to achieve this.Any help is very much appreciated.
1 Answer
Schedules List on Opportunity Line Item cannot be customized. You need to create a Visualforce page with OpportunityLineItem as StandardController and query all OpportunityLineItemSchedules related to that OpportunityLineItem and display them on the Visualforce page.
you can add this Visualforce page on OpportunityLineItem Page Layout and remove standard Schedules related list.
VFPage:
<apex:page standardController="OpportunityLineItem" extensions="revSchedulesCls">
Rrecords : {!lstSchedules}
<script>
alert('{!lstSchedules}');
</script>
==========
public class revSchedulesCls{
public List<OpportunityLineItemSchedule> lstSchedules{get; set;}
public revSchedulesCls(ApexPages.StandardController sc){
OpportunityLineItem oli = (OpportunityLineItem)sc.getRecord();
lstSchedules = [Select id, quantity,revenue, scheduleDate from opportunityLineItemSchedule where opportunitylineitemid=:oli.id];
}
}
This is a rough write up and I am able to display OpportuniyLineItemSchedules in OpportunityLineItem Layout. Just change your code accordingly.
-
:Thanks for your reply.If possible can u help me out with some example related to this.– nikkeySep 30, 2014 at 18:27
-
:Hey i tried manupilating ur code but i do get some errors.I have created a custom object as :opportunitylineitem and fields as part numbers,pricing request,quantity and price.When i append them i do get an Error As :System.TypeException: Invalid conversion from runtime type SOBJECT:OpportunityLineItem__c to SOBJECT:OpportunityLineItem Class.revSchedulesCls.<init>: line 4, column 1– nikkeyOct 1, 2014 at 9:29
-
Hey why did you create a custom object. You can use Standard OpportunityLineItem(Opportunity Product) object right. Oct 1, 2014 at 12:56
-
:No,my client would like to have a custom object and based on that i should create a VF Page and populate them in Schedule.Eg:Opportunity-->products---productname-->Schedule-->Datecolumn --->remove datecolumn and dynamically populate the value of pricing request and quantity.– nikkeyOct 1, 2014 at 16:30