1

I am trying to build a custom Visualforce page to add to a Servicecloud component. This is what I have currently.

    <apex:page standardController="Case">

 <apex:includeScript value="/support/console/37.0/integration.js"/>
 <script type="text/javascript">
        function openPrimaryTab() {
            sforce.console.openPrimaryTab(undefined, 
               '{!URLFOR( $Action.Case.View, Case.Id )}', true, 'example');
        }

This makes a link to the current case, which doesn't really do much obviously. However, I would like to make an URL to the Account of a Case, which is a lookup field. How would that work exactly with URLFOR? Unfortunately it isn't as simple as Action.Case.Account.View.

Thanks!

1 Answer 1

3

You want to do:

URLFOR($Action.Account.View, Case.Account.Id)

The view action just tells what page to go to, so set it to the Account view page.

Then use the Account Id from the Case to set which Account you are viewing.

5
  • That worked! I went through the online resources but couldn't really find anything useful regarding $action or URLFOR. Am I missing any resources? Aug 23, 2016 at 15:25
  • 2
    See $Action global variable and Functions.
    – Adrian Larson
    Aug 23, 2016 at 15:30
  • It's in the very back of the visualforce guide under global variables.
    – martin
    Aug 23, 2016 at 15:31
  • Saw both, but still couldn't figure out how to get it to go to Account. Must be me... Aug 23, 2016 at 15:36
  • 1
    No worries. It always helps to see an example.
    – martin
    Aug 23, 2016 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .