2

We are currently attempting to restrict which files can be globally uploaded in our org using information present on the ContentVersion / Attachment objects. However, in the case of files uploaded through Salesforce Classic chatter comments, it appears that this action does not fire triggers on ContentVersion or Attachment objects. While submitting the comment fires triggers on FeedItem, it does not affect the file which is already uploaded at the moment of selection. I can see that under the hood the file data is posted to a url similar to chatter/handlers/chatterfile

Steps to Reproduce in Salesfose Classic

  1. Start creating a chatter comment
  2. Press attach files
  3. Select a file from the computer
  4. The file is uploaded with no triggers being ran

I would appreciate any help or possible workaround on this issue

1 Answer 1

1

I have created two triggers on one ContentVersion and other on ContentDocumentLink and tried to upload the files using chatter comment. i found both the trigger is firing if you are uploading a new file.

enter image description here

If you are adding a file directly from salesforce, The trigger will not fire for contentVersion, but will fire for ContentDocumentLink.

enter image description here

If you are in classic, make sure to enable this setting:-

enter image description here

What i observed is, The contentversion trigger is not firing, but contentdocumentlink trigger is firing after clicking on comment button.

I think, you have to rely on the contentDocumentLink trigger then.

5
  • Its not firing in Salesforce classic, can you try this in classic? Thank you Aug 18, 2020 at 11:28
  • Please read my update in question, @junieadlawan Aug 18, 2020 at 11:42
  • Thanks @sankeykumar, But when you uploaded a file in Chatter Comment it will be saved in salesforce permanently even without clicking the Comment button. So the file should be validated upon uploading and not after clicking the comment button. Aug 18, 2020 at 12:01
  • I have verified, it is only getting saved post comment in classic. Aug 18, 2020 at 12:07
  • What are your steps to verified? Because on my end its saving permanently except when you click the cancel button(it will be deleted). Aug 18, 2020 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .