0

We have a custom Service console that uses a pageBlockTable to display the recent Cases for a selected Contact. I would like to use the Case.id from each row to open a new window, as there is information in the current Console that is easier to reference w/o having to switch Tabs all the time (vs. alt+tab, or controlling the position of the new window.

I have a button in an iFrame that works as intended to open a new Window; from the Case list^, though, the selected Case either replaces the current page (href version, below) or opens a new tab (outputLink version).

In the example below, I commented out the outputLink (which opens in a new tab) for the time being. The button replaces the existing page, which is less useful.

   <apex:column width="100px" headerValue="{!$ObjectType.case.fields.casenumber.label}">
             <!-- apex:outputLink value="/{!historyItem.id}" onclick="openCaseHistory(); return false;" target="_blank" >
                     <apex:param name="isdtp" value="lt" />
                     {!historyItem.casenumber}
            </apex:outputLink -->
            <!-- button version -->                                           
            <a href="/{!historyItem.id}" class="btn" style="text-decoration:none" 
                                        onclick="window.open(this.href, 'caseWin', height=750,width=1400,toolbar=no,location=no,status=no'); return false;">
                    {!historyItem.casenumber}
            </a>
       </apex:column>
       <script>
                function openCaseHistory() {
                    console.log('https://cs15.salesforce.com/{!historyItem.id}?isdtp=vw');
                    var historyWindow = window.open('/{!historyItem.id}/e?retURL=%2F{!selectedContact}&isdtp=lt',
                        '_blank',
                        config='height=750,width=1400,toolbar=no,menubar=no,location=no,status=no');                            
            }                                                                   
    </script>
  • Unfortunately you can't tell browser whether it should open link in new browser tab or new browser window. It is up to user to define this behaviour in browser settings. – IvanR Nov 10 '14 at 15:57
  • Which would make sense, yet on the same page, an apex:commandButton can call a similar method and it will open a separate window? If so, so be it; it just seems arbitrary. – Duncan Stewart Nov 11 '14 at 19:37

Your Answer

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

Browse other questions tagged or ask your own question.