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
Oriel SupportOriel Support 

dynamic apex report source

I would like to build a report based on the results of an apex script.  I can create the script and populate the custom object no problem.  What I would like to know is how to run the apex script every time the report is generated.  Is this possible or must I schedule the script to run periodically?
Peter FribergPeter Friberg
I would suggest you create a VF-page that autoruns a method in the controller that will generate the custom object data and then relocates to the url of the report (e.g. the method returns the url to the report whick consist of a '/' followed by the report Id). The VF-page can be reached using a custom button or custom link and placed on home page or on a record home page.
Oriel SupportOriel Support
I have never done a VF page in this fashion before, but it sounds like it would be pretty simple.  Is there an example available anywhere that would demo the technique?
Thank you for your response!