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
samrat.1985@lntinfotechsamrat.1985@lntinfotech 

How to automatically invoke acontroller when ever a VF page is browsed

Hi,

 

I have a controller, which does some calculations when included in a VF page. But my requirement is to invoke this class automatically in each and every visualpage available without having to include it explicitly using supporting page.

 

How can this be possible. You can relate my controller class as a system process which needs to run in the background every time a page is browsed.

 

Any suggestions?

Avidev9Avidev9

System Process : That runs on every page display, its not possible.

 

You can have a schedule process, but that will run on specified time only.

 

One soultion will be creating a VF component and include the same in every page where you want to run. Well if its a standard page you can inline vf pages.

 

But if you want it to run for every pages without making any code changes to existing page. I will suggest you to create a VF page with the functionality and include the same in a iframe in a Sidebar Home Page component and mark it visible for every profile. In this way you can achieve the desired functionality.

 

Home page component provides a narrow html area , write a small code to include your VF as iframe

samrat.1985@lntinfotechsamrat.1985@lntinfotech

Thanks for the reply.

but i am unable to achieve my functionality using the Homepage side bar component.

 

Suppose i have 10 VF pages. And I have a controller which calculates the performance of these 10 pages, and shows it to me.

And these 10 VF pages are not at all developed by me. How can i get my controller to calculate automatically without need of explicitly including it in those 10 pages. 

I am struggling on alternatives here

Avidev9Avidev9
Well its simple.... you dont have any alternative and seems like you have to touch the pages!

Or create a VF component and include them in the pages! this wont require anything you just have to place the component in the page and it will have its own controller
samrat.1985@lntinfotechsamrat.1985@lntinfotech

I have already tried it by using Apex:include tag. I dont see component will be any different as end of the day i will have to edit existing pages which i dont want.

Let me know if you have any automatic method for inculding a component or page. That can solve the problem

Avidev9Avidev9
Sadly there is NO automatic way!