Skip to main content
I need to be able to automatically add a collaborator permission for a specific user when a file is uploaded to Accounts and Opportunties. I found the following which is a trigger on the ContentVersion object that creates a ContentDocumentLink for anyfile that is uploaded into Saleforce. Is there any way to set 'Collaborators' as default for a file when it get uploaded? (https://trailblazers.salesforce.com/answers?id=9063A000000DzyRQAS) The trigger from the answer: 

 

 

trigger ContentVersionTrigger on ContentVersion (after insert) {

insert new ContentDocumentLink(

ContentDocumentId = trigger.new[0].ContentDocumentId,

LinkedEntityId = '<a user id>',

ShareType = 'C',

Visibility = 'AllUsers'

);

}

 

With this, I am able to specify a particular user, but I am not able to filter for only files loaded to Accounts and Opportunties. My search has fallen short, is there a way to filter or query for only files that are uploaded to Accounts and Opportunities and if so, how?
1 件の回答
0/9000