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
utz1utz1 

How to redirect to service cloud console from visualforce page?

Hello,

When I click on cancel button then I want to redirect on console page. Right now, when I click on Cancel Or Save button it holds me on same page. I want my screen should be pops back to console screen when I click on cancel button.

<apex:page standardController="OpportunityLineItem">
  <SCRIPT>
  window.top.location.replace("{!URLFOR($Action.OpportunityLineItem.Edit, OpportunityLineItem.id, [saveURL='/'+OpportunityLineItem.id , cancelURL='/console'], true)}");
  if(top.location.href == "https://eu9.salesforce.com/console") {
  //https://cs89.salesforce.com/console
        if(window.confirm(top.location.href)) {
            window.top.location.replace("{!URLFOR($Action.OpportunityLineItem.Edit, OpportunityLineItem.id, [saveURL='/console' , cancelURL='/console'], true)}");
        }
  }
  else {
    <!--if(window.confirm("Are you Sure ??")) { -->
       window.top.location.replace("{!URLFOR($Action.OpportunityLineItem.Edit, OpportunityLineItem.id,[saveURL='/'+OpportunityLineItem.id , cancelURL='/'+OpportunityLineItem.Opportunity.id ],true)}");
    <!--}-->
  }      
  </SCRIPT>
</apex:page>

Thanks,
Utkarsha