2

For e.g. when we upload any file under files tab then the files details are saved in the ContentVersion object and we can see these details.

But when we upload any chatter file, that file details are also saved in the ContentVersion object but we can not do following things with this record

  1. We can not see that record - if we query all records of ContentVersion object then we will not get that records which is related to chatter file in the returned list. (But it is possible to see this record if we query it by its Id).
  2. Trigger will not invoked for that record.

If anyone can share your thoughts on it that will really help me. Thanks!

  • trigger can be invoked on ContentDocument – Santanu Boral Mar 20 '17 at 6:51
  • check SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument – Santanu Boral Mar 20 '17 at 6:51
  • Thanks for the reply @SantanuBoral. Yes, I already tried this but the same thing happens with ContentDocument too. – Kapil Kaushik Mar 20 '17 at 6:59
  • Sorry to chip in, I remember last time when I run query Select Id from ContentVersion it will return the data. I am system admin. But now, it return zero but I know there is data. Is there any changes on how we query it recently? – unidha Aug 11 '17 at 4:28
2

To solve your purpose trigger needs to be invoked on ContentDocumentLink.

When you are uploading the file from File Tab trigger will fire on "ContentVersion" object, but when you are uploading file from Chatter tab you need to write trigger on "ContentDocumentLink" object.Then only you will be able get the Content Document Id.

It seems like a standard feature of salesforce that the triiger on contentVersion doesn't get called when you are uploading the file from File Tab.

  • Sorry @AvijitDas, but your answer is out of context. My basic requirement is to invoke trigger on the ContentVersion or on ContentDocument object. If you think you are now clear with the problem then please suggest a solution and it will be really appreciable. Thanks – Kapil Kaushik Mar 20 '17 at 12:07
  • @KapilKaushik : I have updated my answer. – Avijit Das Mar 20 '17 at 13:22
  • I found one similar problem and it is somewhat related to this question. Please find it here salesforce.stackexchange.com/questions/169556/… – Kapil Kaushik Apr 12 '17 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.