function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Julian Juez AlfaroJulian Juez Alfaro 

VF page used in "Home" page to open records in Service Cloud Console

Good day to you all, I know nothing about developing and less than nothing of javascript, and I hope anyone can help me with the following:

We are using VF pages as components of the standard "Home" page (instead of just having the standard components "tasks", "items to approve", etc, we are adding some other stuff). Our VF page looks like this:

<apex:page controller="QueueCases" sidebar="false" showHeader="false" setup="false"  action="{!renderdiffview}">
   
    <apex:form >
    <apex:pageBlock >
                <apex:pageBlockTable value="{!results}" var="c" rows="50" id="cases_table">             
               
                     <apex:column >               
                        <a href="javascript:srcUp(%27%2F{!c.Id}%3Fisdtp%3Dvw%27);">{!c.CaseNumber}</a>         
                        <apex:facet name="header">Case Number</apex:facet>
                      </apex:column>
                                  
                     <apex:column headerValue="Subject">
                         <apex:outputField value="{!c.Subject}"/>
                    </apex:column>
                   
                     <apex:column headerValue="Date/Time Opened">
                        <apex:outputField value="{!c.CreatedDate}"/>
                    </apex:column>
                                    
                     <apex:column headerValue="Account Name">
                        <apex:outputField value="{!c.Accountid}"/>
                      </apex:column>

                </apex:pageBlockTable>
</apex:pageBlock>
    </apex:form>
</apex:page>


However, when I go to the "Home" page (using either the Service Cloud Console or not) and click on the Case Number, nothing happens.
If I replace
                      <apex:column >              
                        <a href="javascript:srcUp(%27%2F{!c.Id}%3Fisdtp%3Dvw%27);">{!c.CaseNumber}</a>        
                        <apex:facet name="header">Case Number</apex:facet>
                      </apex:column>
with
                      <apex:column >
                        <a target="_parent" href="/{!c.id}">{!c.CaseNumber}</a>
                        <apex:facet name="header">Case Number</apex:facet>
                      </apex:column>

then it works (because it opens the case) but not like we want to, because it does not open the case in the Service Cloud Console (we want the case to be open on the Service Cloud Console).

I have spent days trying to fix it  but what can we expect from someone like me with absolutely no programming knowledge? :-(
I have searched on the internet and tried to modify code from others. I have come to understand that I need  to use javascript and I guess also the srcUp function. I have read lots of posts and the entire cook book. Looked at the service cloud console integration toolkit. Nothing.

Any help will be much appreciated!

Thank you,
Julian
NehalNehal (Salesforce Developers) 
Hi,

Please go through the below sample code that will help you in rectifying your code:

Visualforce Page:
=====================

<apex:page controller="UnassignedCasesQue" sidebar="false" showHeader="false" setup="false">
<apex:includeScript value="/support/console/26.0/integration.js"/>

    <apex:form >
    <apex:pageBlock helpTitle="UnassignedCases" helpURL="http://www.intermec.com/support" mode="maindetail">
                <apex:pageBlockTable value="{!results}" width="80%" columns="12" var="c" rows="50" id="cases_table">
                    <apex:column >
                    <a HREF="#" onClick="javascript:sforce.console.openPrimaryTab(null,'/{!c.Id}',true,'{!c.CaseNumber}');">{!c.CaseNumber}</a>
                        <apex:facet name="header">Case Number</apex:facet>
                    </apex:column>
                   
                    <apex:column headerValue="SBU">
                        <apex:outputField value="{!c.SBU__c}"/>
                    </apex:column>
                   
                   <apex:column headerValue="Hardware">
                      <apex:outputField value="{!c.Hardware__c}"/>
                    </apex:column>
                   
                     <apex:column headerValue="Subject">
                         <apex:outputField value="{!c.Subject}"/>
                    </apex:column>
                   
                    <apex:column headerValue="Status">
                        <apex:outputField value="{!c.Status}"/>
                    </apex:column>
                  
                    <apex:column headerValue="Priority">
                        <apex:outputField value="{!c.Priority}"/>
                    </apex:column>
                   
                     <apex:column headerValue="Case Origin">
                        <apex:outputField value="{!c.Origin}"/>
                    </apex:column>
                   
                     <apex:column headerValue="Date/Time Opened">
                        <apex:outputField value="{!c.CreatedDate}"/>
                    </apex:column>
                   
                     <apex:column headerValue="Days Without Update">
                        <apex:outputField value="{!c.Days_without_update__c}"/>
                    </apex:column>
                   
                    <apex:column >
                    <a HREF="#" onClick="javascript:sforce.console.openPrimaryTab(null,'/{!c.Accountid}',true,'{!c.Account.name}');">{!c.Account.name}</a>
                        <apex:facet name="header">Account Name</apex:facet>
                    </apex:column>
                   
                    <apex:column >
                    <a HREF="#" onClick="javascript:sforce.console.openPrimaryTab(null,'/{!c.Contactid}',true,'{!c.contact.Name}');">{!c.contact.Name}</a>
                        <apex:facet name="header">Contact Name</apex:facet>
                    </apex:column>
              
                </apex:pageBlockTable>
</apex:pageBlock>
   </apex:form>

</apex:page>
                     
APEX Class:
=============
global class UnassignedCasesQue
{
   public list<case> results;
   public list<case> Openresults;
  
   public PageReference renderdiffview()
   {
    results = [select id,casenumber, Subject,Status,Priority,Origin,
              CreatedDate,AccountId, ContactId,
              OwnerId from case where isClosed=false and OwnerId='00G90000001ulgr' limit 5];
    return null;
   }
  
   public List<Case> getresults() {     
     return results;
   }

   public List<Case> getOpenresults() {     
     return Openresults;
   }

 
}

Also refer few links as below for your reference:
1.https://developer.salesforce.com/forums?id=906F000000098wUIAQ
2.https://developer.salesforce.com/forums/ForumsMain?id=906F000000097CKIAY
3.http://salesforce.stackexchange.com/questions/18254/how-to-open-a-subtab-for-a-primary-tab-in-a-service-console-when-clicked-on-a-cu
4.http://salesforce.stackexchange.com/questions/5009/open-a-service-console-primary-tab-from-a-custom-component-module

I hope this helps. Please mark this as a "Best Answer" if this has resolved your issue.
Julian Juez Alfaro 3Julian Juez Alfaro 3
Hey! Are you Palapala???