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
Victor PVictor P 

Select specific Schedule ID from OpportunityLineItemSchedule

Trying to acess the first date from a Revenue Schedule and use it to read and write to it via the API.
I'm trying to access the date and the Schedule ID of the first date (date1) from the "Schedule Date" object in the OpportunityLineItemSchedule.

But I'm not sure how to create this in order for it to be accesible via the API. 
How can I execute this? Is it necesary to create a custom field via the setup and then write to it via apex code?

Few things I've tried. 

The SOQL query to do this is:
SELECT Id, ScheduleDate, OpportunityLineItem.Id FROM OpportunityLineItemSchedule ORDER BY OpportunityLineItem.Id DESC, ScheduleDate DESC

The code for this would be something similar to this:
List<OpportunityLineItemSchedule> lineSchedules = [select Id from OpportunityLineItemSchedule where OpportunityLineItemId = :lineItems[0].id 

I appreciate your help!