function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShirinShirin 

OpportunityLineIteSchedule fields

I am new to Apex , actually just started some work. I have opportunities with products and schedules. I have another customer object called milestones. I have a third object called Forecast. I need the revenue and the scheduledate fields to be populated in the Forecast record. I am unable to access the revenue & schedule date at all from the opportunity line item schedule.

 

I am trying to wrtie a trigger like the one below, but just not successful. I know I must be missing out something or I am wrong. Please help on the same.

 

trigger RevInsert on OpportunityLineItem (After Insert) {

For(OpportunityLineItem OLi:Trigger.New){
For( OpportunityLineItemSchedule OLis:Trigger.New){
Forecast__c F = New Forecast__c(Date__c = OLis.ScheduleDate);

Insert F;
}

}