Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. insert file;
  2. ContentVersion cv = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :file.Id];
  3. ContentDocumentLink link = new ContentDocumentLink();
  4. link.LinkedEntityId = sr.id; // this is record i want the file to be related to
  5. link.ContentDocumentId = cv.contentdocumentid;
  6. link.ShareType = 'V';
  7. link.Visibility = 'AllUsers';
  8. insert link;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement