How to Relate a File to multiple records in Salesforce?

How to Relate a File to multiple records in Salesforce?

Sample Code:

  1. ContentDocumentLink objCDL = new ContentDocumentLink();  
  2. objCDL.ContentDocumentId = ‘0695A000004dRpRQAU’;//Id of the file  
  3. objCDL.LinkedEntityId = ‘0035A00003MuvnuQAB’;//Id of the record for sharing  
  4. objCDL.ShareType = ‘V’;  
  5. insert objCDL;  


Leave a Reply