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
domdickdomdick 

Revenue schedule not inserting schedule

Hello All,

 

I am inserting a OpportunityLineItem using Apex controller class which has a default revenue schedule defined. The product is added correctly but no revenue schedule created. If i will create the same line item via the UI then the default schedule has been created as expected.

 

How can i achieve this? any sample code will help.

 

thanks,

Dinesh

Vinit_KumarVinit_Kumar

Dinesh,

 

Try below code :-

 

OpportunityLineItemSchedule olis = new OpportunityLineItemSchedule
(
OpportunityLineItemId='<some id in your org>',
Type='Both',
ScheduleDate= System.today(),
Revenue=15.0,
Quantity=2.0
);
insert olis;