You need to sign in to do that
Don't have an account?
Schuetzler
Trigger when Account is viewed
I am looking for a way to run Apex code, or possibly a trigger, whenever an Account is viewed. The Apex code will be used to update a field at the account level, but I don't want to wait for the Account to be updated.
Is this possible?
If you mean when a user clicks on the link to navigate to the account detail page in the salesforce.com UI then you can if you override the view action for account with a visualforce page and then hook your apex to the page's action attribute.
All Answers
If you mean when a user clicks on the link to navigate to the account detail page in the salesforce.com UI then you can if you override the view action for account with a visualforce page and then hook your apex to the page's action attribute.
An option might be a visualforce page you put on the page layout...
Or, alternately, you can override the detail page in order to add this functionality.
You could indeed put a visualforce page in the page layout and call some code in the controller.
Have a look at my "Account Last Viewed by" solution... Just install into your development organization:
https://login.salesforce.com/?startURL=%2Fpackaging%2FinstallPackage.apexp%3Fp0%3D04tA00000005Ww6
Adapting the controller should be easy.
Have fun!
//Hannes