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
VIKASH CHAND KUMARVIKASH CHAND KUMAR 

not able to create list of contentdocumentlink for the list of contentversion

i am trying to create list of contentversion for set of Id and blob data, which i am able to create, but now when i am trying to create contentdocumentlink for the list of contentversion, i am not getting any field which i should be relating to my LinkedEntityId.

List<ContentVersion> cvc=new List<ContentVersion>();
List<ContentDocumentLink> cdll = new List<ContentDocumentLink>();
 for(Id x : y.keyset()){  
        ContentVersion cv=new ContentVersion();
        cv.Title=XXXXXX; 
        cv.VersionData= y.get(x);
        cv.PathOnClient=XXXXXX; 
        cvc.add(cv);
    }  
Database.Insert(cvc);
            for(ContentVersion cvv: [Select Id,ContentDocumentId from ContentVersion where ?????? IN : y.keyset() ]){
                ContentDocumentLink cdl = new ContentDocumentLink();
                cdl.ContentDocumentId = cvv.ContentDocumentId;
                cdl.LinkedEntityId = ????????
                cdl.ShareType = 'V';
                cdll.add(cdl);                              
                  System.debug('Hello');            
            }          
                
                insert cdll;