+ Start a Discussion
desmoquattrodesmoquattro 

apex:outputLink and Service Cloud Console

Hey folks. I'm writing a Visualforce page that will act as a custom console component in the Service Cloud Console, and I'm seeing some odd behavior when using apex:outputLink. Net-net: the outputLink tag intelligently renders differently when in the console vs outside the console (fantastic) but for some reason, the Javascript function it calls when operating *in* the console cannot be found...even if I import the Console Integration Toolkit.

 

Here's the VF page in question:

<apex:page standardController="Case" extensions="MyExt" showHeader="false" sidebar="false">
<script src="/support/console/28.0/integration.js" type="text/javascript"></script>
 <apex:pageBlock rendered="{!initiated}" title="Users">
  <apex:pageBlockTable value="{!portalUsers}" var="user">
   <apex:column title="Username">
    <apex:outputLink value="/{!user.Id}">{!user.Username}</apex:outputLink>
   </apex:column>
   <apex:column title="Name" value="{!user.Name}"/>
  </apex:pageBlockTable>
 </apex:pageBlock>
</apex:page>

 

Even when including the console toolkit js file (using both manual <script> tags and <apex:includeScript>) I get the following error when clicking on the rendered link in the console:

Timestamp: 6/23/13 6:31:29 PM
Error: ReferenceError: srcUp is not defined
Source File: javascript&colon;srcUp('%2F005i0000000poJdAAI%3Fisdtp%3Dvw');
Line: 1

 Any thoughts on what I may be missing?

 

 

 

 

 

Neha LundNeha Lund

For Console URL changes for the detail records

 

ui/support/servicedesk/ServiceDeskPage/?tsid=Idof therecord

desmoquattrodesmoquattro

I had thought of that too, but the outputLink tag is still rendering the srcUp() function automatically, which is not defined. So the code now looks like this:

...
<apex:includeScript value="/support/console/28.0/integration.js"/>
<apex:pageBlock rendered="{!initiated}" title="Portal Users">
<apex:pageBlockTable value="{!portalUsers}" var="user">
<apex:column title="Username" headerValue="Username">
<apex:facet name="Username"></apex:facet>
<apex:outputLink value="ui/support/servicedesk/ServiceDeskPage/?tsid={!user.Id}">{!user.Username}</apex:outputLink>
</apex:column>
<apex:column title="Name" value="{!user.Name}"/>
<apex:column title="Last Login" value="{!user.LastLoginDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
...

 But I get the same result.

Neha LundNeha Lund

Jut try

<apex:outputLink value="/ui/support/servicedesk/ServiceDeskPage?tsid={!user.Id}">{!user.Username}</

desmoquattrodesmoquattro

Thanks Neha. I tried that as well, with the same results.

michaelforcemichaelforce

I've run into this problem myself just now.  Through experimenting I see that old-fashioned <a href=''> tags are not modified to the srcUP function and so they work as expected.  I'm trying to think of a reason why this workaround might bite me in the ass... can't think of any so far.

arbaconarbacon
Had the same issue and here was my way to implement it. change the value link to be javascript and it will execute.
javascript:window.open('url','_blank') for example.  If you want the link to be a subtab for the console, then the following:
javascript:var openSubtab = function openSubtab(result) {
//Now that we have the primary tab ID, we can open a new subtab in it
var primaryTabId = result.id;
sforce.console.openSubtab(primaryTabId ,'url', true,
'Tab Title', null);
};

if (sforce.console.isInConsole()) {
sforce.console.getEnclosingPrimaryTabId(openSubtab);
} else {
window.open('url', '_blank');
}
Nikhil DandekarNikhil Dandekar
Set the showHeader attribute to true. In console even if you set it to true UI is not going to change.To want output link to work set header to True . No need of opensubtab functions.
Brian Knezek 13Brian Knezek 13
Nikhil, you are brilliant! I've read dozens of clever, but complicated suggestions for this problem, but you've given the real answer...

THE ANSWER IS: On the VF page, set showHeader="true"

This solves mutliple problems related to srcUp when displaying a Visualforce page in a Console tab.
  • Detail page Lookup fields
  • Related List records that display in <apex:detail>
  • javascript buttons that rely on srcUp
narsavagepnarsavagep

I'm experiencing the same issue when the page renders in Lightning.  To further complicate, I cannot add showHeader="true" because I don't want the header on the page as it is displayed within a page.  

I believe the solution I'm going to have to use is to not use "apex:outputLink" and just put in standard <a href> HTML tag.  :(