Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- insert file;
- ContentVersion cv = [SELECT id, ContentDocumentId FROM ContentVersion where Id = :file.Id];
- ContentDocumentLink link = new ContentDocumentLink();
- link.LinkedEntityId = sr.id; // this is record i want the file to be related to
- link.ContentDocumentId = cv.contentdocumentid;
- link.ShareType = 'V';
- link.Visibility = 'AllUsers';
- insert link;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement