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() {
               '{!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.



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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.