• Merry Paul
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
List<OpportunityLineItem> oLIList = new List<OpportunityLineItem>();
oLIList = [SELECT Id, Product2Id, OpportunityId
                     FROM OpportunityLineItem
                    WHERE OpportunityId IN :oIdSet];
Map<Id, Map<Id, OpportunityLineItem>> oLIMap = new Map<Id, Map<Id, OpportunityLineItem>>();
        for(OpportunityLineItem oLI : oLIList){

I am querying for OpportunityLineItems and I need to put them in a map nested in a map were the inner map key is the product2Id and the outer map key is the opportunityId. But I cannot figure how to do this in the for loop. Also, the value of the inner map should be the OpportunityLineItem record. Thank you for your help.