• Manuj Pandey 18
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm trying to create a class based on files, which is ContentDocument object.  I'm trying to create a map where the key is the ID of the ContentDocument and the value is a list of LinkedEntityId that are related to the key.  

I'm not sure how to do this.  I took a shot here but I don't think it's correct.  

I'm thinking that the key is correct, but I don't know how to get the values for each key.  Each key will have a few Ids for the value. 


***I'm passing a list called 'docs' from a trigger.  The list is essentially all of the docs that were passed from trigger.new


  public static void ProcessFiles(List<ContentDocument> docs){
        
Map<Id,List<ContentDocumentLink>> FilesMap = New Map<Id,List<ContentDocumentLink>>();
 
List<ContentDocumentLink> l = [SELECT LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN : docs];


 
        for(ContentDocument c : docs){
            FilesMap.put(c.Id,l);
                
        }
        
    }  



Any help would be awesome!