Skip to main content
1 of 2
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

You need to alias some field to Id in order for the Map<Id, SObject>(List<SObject>) constructor to work.

SELECT
    OpportunityLineItemId Id, 
    MIN(ScheduleDate) Starts
FROM OpportunityLineItemSchedule 
WHERE ...
GROUP BY OpportunityLineItemId
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431