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
sieb4mesieb4me 

Open a link in console?

Hi,
We have this vf page which works fine but links dont open in console, it opens in normal case page layout

<apex:page StandardController="Case" tabStyle="Case" Extensions="RecentEsc">
    <apex:form style="width:100%;height:400px">
        <apex:pageBlock mode="maindetail">
                <apex:pageBlockTable value="{!Resultsall}" var="o">
                        <apex:column headerValue="Case Number">
                           <apex:outputLink value="/{!o.id}" target="_blank">{!o.CaseNumber}</apex:outputLink>
                        </apex:column>
                        <apex:column headerValue="Contact Name" value="{!o.Contact.Name}"/>
                        <apex:column headerValue="Status" value="{!o.Status}"/>
                        <apex:column headerValue="Priority" value="{!o.Priority}"/>
                        <apex:column headerValue="Subject" value="{!o.Subject}"/>
                        <apex:column headerValue="Date/Time Opened" value="{!o.CreatedDate}"/>
                        <apex:column headerValue="Owner Name" value="{!o.Owner.Name}"/>
                </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

How do i ensure it opens in service console.
I noticed this online but not sure how to use this code on page above.
http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_sample_vf.htm

thanks

Elie.RodrigueElie.Rodrigue
You could try this : 
<apex:outputLink value="#" onclick="sforce.console.openPrimaryTab(undefined,
               '/{!o.id}', true, 'salesforce');">{!o.CaseNumber}</apex:outputLink>


If this doesnt work, you could use standard script and a tags : 

<script type="text/javascript">
function openPrimaryTab(url) {
            sforce.console.openPrimaryTab(undefined,
              url, true, 'salesforce');
        }
</script>

and replace the outputlink with 
<A HREF="#" onClick="openPrimaryTab('/{!o.id}');return false">{!o.CaseNumber}</A>

Regards,

Elie Rodrigue
www.elierodrigue.com
Elie.RodrigueElie.Rodrigue
did you try out the solution?
EJN5007EJN5007
Élie,

I need your help! You seem to be just the man to talk too! I searched high and low for this problem.

I tried two options for this. The first one works beautifully, however I need to calculate further.

The Second method is what I need to work, which it does. The catch is... For some reason the second method always treats the user "click" as the last record in the list. For example, if I click record 3 of a 5 record list. The action will behave as though I clicked record 5.

Looking forward to hear from you Élie. Thanks!
P.S. There will definitely be KUDOS

OPTION 1 - WORKS BEAUTIFULLY, BUT CANT CALCULATE
<apex:pageBlock>
<apex:pageBlockTable value="{!OtherActions}" var="action">
<apex:column>
<a href="javascript:sforce.console.openPrimaryTab(null , 'https://na15.salesforce.com/apex/{!action.URL}?actionname={!action.Name}', true, ' ', null, null);">{!action.Name}</a>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>

OPTION 2 - DOES NOT WORK, ALWAYS BEHAVES AS LAST ACTION IN LIST
<apex:pageBlock>
<apex:pageBlockTable value="{!OtherActions}" var="action">
<apex:column >
<a href="#" onClick="OpenOtherActA();return false">{!action.Name}</a>
<script type="text/javascript">
        function OpenOtherActA() {
            sforce.console.getEnclosingPrimaryTabId(OpenOtherActB);
        }
        var OpenOtherActB = function OpenOtherActB(result) {
            var tabId = result.id;
            sforce.console.openPrimaryTab(tabId , 'https://na15.salesforce.com/apex/{!action.Name}?actionname={!action.Name}', true, ' ', null, null);
        };
    </script>
</apex:column >
</apex:pageBlockTable>
</apex:pageBlock>


EJN5007EJN5007
Now that im looking closely at your code. It looks like as though I have to pass the variables through the method
PinkeyPinkey
Thanks Elie. your solution resolved my problem