function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akash1997Akash1997 

File View

How to get the number of times a file is viewed in Apex?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Akash,

I found the below links please try it and let me know if it works.

>>https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_final.htm

It states below statement:
"Member final variables can be changed in initialization code blocks, constructors, or with other variable declarations.
To define a constant, mark a variable as both static and final."

>>In case if you are finding for the number of times a file has been downloaded please find the below article:

https://help.salesforce.com/articleView?id=reports_content.htm&type=5

It shows that there is a field by the name "Num Downloads".

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thank you!

Warm regards!
Anutej Poddaturi
 
Akash1997Akash1997
Hey Anutej,
Actually I am showing the file details on a LWC component from where we can also view the file. What I want is to keep a count of how many times a particular file is previewed.
Like on the file object we can see how many times a file is viewed. Is there any way through which I can get that info in Apex so that it can be used in my component?