2

I need to call a static method when the details page for an object loads. Currently, the only way I know I can do this is to create a Visualforce page and add it to the profile.

Is there another way?

d0001
  • 518
  • 4
  • 18
  • What is it you are trying to accomplish? – Adrian Larson May 21 '15 at 21:20
  • I need to call a method in a third party managed package/plugin. – d0001 May 21 '15 at 21:23
  • Yes, you can create a webservice called by a self removing button. Let me know if you want details. – Caspar Harmer May 21 '15 at 21:29
  • 1
    Sound interesting but I'm not sure if its less "hacky" than embedding the a Visualforcepage. – d0001 May 21 '15 at 21:35
  • It's pretty hacky. But it has the advantage of being invisible, whereas the page is 200px that you can't hide... – Caspar Harmer May 21 '15 at 22:15
  • @CaspNZ, how does button evaluate without clicking it? – dzh May 21 '15 at 22:48
  • @dzh, check out this answer here: http://salesforce.stackexchange.com/a/73536/550 – Caspar Harmer May 21 '15 at 23:17
  • You can also do it using a sidebar visualforce component. Whenever page is loaded, this sidebar component also will be loaded. Then using javascript you can access parent iframe URL. This can be used to determine the type of object and if it matches the type you need, make call to static method – Victor May 22 '15 at 02:44
  • @CaspNZ, thanks for the ref. I had some fun with it and made a useless button that runs away from cursor: https://github.com/sjurgis/salesforce-prank-button/ – dzh May 23 '15 at 11:11
  • Haha, that's hilarious! Nice work. – Caspar Harmer May 23 '15 at 21:28

0 Answers0