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
Joe StolzJoe Stolz 

VF Page as Custom Console Component: commandLink target="?"

I have a VisualForce page where a number of opportunity fields are availble to edit. This page works as needed on the standard opportunity page layout, but I have a new requirement to make the page available in a console. When the save button is clicked, the whole screen refreshes and only the opportunity is visible, not the list view or custom components. I know this has something to do with the save commandLink target that I have specified, but I am unsure of what my target should be within the console. Any suggestions? 

I need the record page to refresh with the values once the save link is clicked.

Thank you,
Joe
Amit Chaudhary 8Amit Chaudhary 8
Hi Joe,

If you want to open the record inside the console only then please check below blog. I hope that will help u 
http://amitsalesforce.blogspot.in/search/label/Console

http://amitsalesforce.blogspot.in/2015/03/how-to-open-new-record-inside-console.html

Include JS in VF page
<apex:includeScript value="/support/console/26.0/integration.js"/>

Write below Java Script code in VF page
<script>

function openTab(id, name) 
{
 if (sforce.console.isInConsole())
  sforce.console.openPrimaryTab(undefined, '/' + id + '?isdtp=vw', true, name);
 else
  window.top.location.href = '/' + id;
}

</script>

Then use below link to open new record
<a href="#" onclick="openTab('{!Obj.id}''{!Obj.name}'); return false;">{!Obj.customKey}</a>

Please let us know if this will help you

Thanks,
Amit Chaudhary
Joe StolzJoe Stolz
Thank you for the response Amit.

I understood your instructions until:
<a href="#" onclick="openTab('{!Obj.id}''{!Obj.name}'); return false;">{!Obj.customKey}</a>
How can I make that work with the apex:commandLink save action? Here is my current code:
<apex:commandLink value="Save" action="{!save}" target="_top" styleClass="btn" style="text-decoration:none;padding:4px;"/>

The goal is for the VisualForce page to refresh and the record to refresh. As a refrence here is all my code with your's added:
<apex:page standardController="Opportunity" showHeader="false" sidebar="false">
<apex:includeScript value="/support/console/26.0/integration.js"/>
  <script>
    function openTab(id, name) 
      {
         if (sforce.console.isInConsole())
           sforce.console.openPrimaryTab(undefined, '/' + id + '?isdtp=vw', true, name);
         else
      window.top.location.href = '/' + id;
      }
  </script>     
<apex:form >        
    <apex:pageBlock title="" id="OppPageBlock" mode="edit">             
        <apex:pageMessages />             
            <apex:pageBlockButtons location="bottom" >                 
                <apex:commandLink value="Save" action="{!save}" target="_top" styleClass="btn" style="text-decoration:none;padding:4px;"/>                 
                <apex:commandButton value="Cancel" action="{!cancel}"/>             
            </apex:pageBlockButtons>                        
        
<!-- Temp Repair Stage -->  
                     
        <apex:pageBlockSection title="Temp Repair Fields" columns="1" showHeader="FALSE" rendered="{!opportunity.StageName == 'Temp Repair Production_RPA'}">                 
            <apex:inputField value="{!opportunity.RPA_NTE_Schedule_Date__c}"/>
            <apex:inputField value="{!opportunity.FM_Pilot_Schedule_Date__c}"/>
            <apex:inputField value="{!opportunity.Upload_post_scope_docs_to_Box__c}"/>
            <apex:inputField value="{!opportunity.Permanent_Work_Needed__c}"/>    
            <apex:inputField value="{!opportunity.CP__c}" label="If no bid needed, please enter the CP here"/>
        </apex:pageBlockSection>

<!-- Proposal Prep Stage -->  
        
        <apex:pageBlockSection title="Proposal Prep Fields" columns="1" showHeader="FALSE" rendered="{!opportunity.StageName == 'Proposal Prep_RPA'}">                 
            <apex:outputLabel value="Scope needs to be approved" style="text-align: right; font-weight: bold; color: #FF0000" rendered="{!opportunity.Scope_Approved__c == null}"/>
            <apex:outputLabel value="Proposal needs to be approved" style="text-align: right; font-weight: bold; color: #FF0000" rendered="{!opportunity.Proposal_Approved__c == null}"/>
            <apex:inputField value="{!opportunity.Create_PR_Plan__c}"/>
            <apex:inputField value="{!opportunity.Prepare_Scope_Documents__c}"/>
            <apex:inputField value="{!opportunity.Create_Contract_in_Sage__c}"/>
            <apex:inputField value="{!opportunity.Create_Photo_Page__c}"/>
            <apex:inputField value="{!opportunity.Build_Final_Bid__c}"/>
            <apex:inputField value="{!opportunity.Submit_Bid_Update_Platform__c}"/>
            <apex:inputField value="{!opportunity.Potential_Cost__c}"/>
            <apex:inputField value="{!opportunity.Potential__c}"/>
            <apex:inputField value="{!opportunity.CP__c}"/>
        </apex:pageBlockSection>
    
<!-- There is more, but the mostly a repeat of the above page block sections -->
 </apex:pageBlock> 
</apex:form> 
</apex:page>

And here is how it looks in my sandbox:
User-added image

Thank you,
Joe