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
adreameradreamer 

Testing code for OpportunityLineItemSchedule

Hi All,

 

I am trying to develop testing code for a package that supports using revenue schedules in opportunity products but, as we know, schedules have to be manually enabled and users installing the package may not use it so it will be disabled.

 

The issue I am facing is that when schedules are disabled, the object OpportunityLineItemSchedule is not part of the org. Consequently, any apex code having a reference to the object will fail during installation because the object is not there.

 

In the package logic I use dynamic queries and I check if the org has the OpportunityLineItemSchedule object so there is no issue with the package functionality

regardless of whether the installer user's org has schedules enabled or not.

 

The issue is with writing the testing code. Here I am facing with having to create records of OpportunityLineItemSchedule object to create the test data. And this automatically introduces a reference to the object.

 

Has somebody has a way around this ?.

 

Thank you very much in advance.

Fernando