Execute Javascript from Formula field

Yes, formula fields can be used to execute javascript code on click. For this, we make use of the HYPERLINK Function.

The syntax for it is:
HYPERLINK("javascript:<your javascript code>","TEXT")
To reload the page:
To open a SubTab:
HYPERLINK("javascript:sforce.console.getEnclosingPrimaryTabId(function(result){sforce.console.openSubtab(result.id, '', true, '' , null);})")  [DEPRECATED FOR USE IN STANDARD SERVICE CONSOLE - USE SRCUP INSTEAD]
Go ahead and knock yourself out!

posted on 6 March 2015

Salesforce Javascript Formula Fields Hyperlink