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
Jim Parker 7Jim Parker 7 

JS button load a specific html in same window

Hello.  I hav an onclick JS button that runs a flow.  Currently, it opens a new tab and executes correctly.  However, I would like to load the current tab/window with the flow URL vs. opening a new tab.  How do I do that?

Existing code below.  Basically, I need to replace the window.open with something else. 
{!RequireScript("/soap/ajax/34.0/connection.js")} 

if("{!Wire_Template__c.Template_Status__c}" =="Approved"){
var base = '' //system.URL.getSalesforceBaseUrl(); 
var url = base+encodeURI('/flow/Wire_Template_Transfer_from_Locked_Template?WireTemplateId={!Wire_Template__c.Id}&retURL=a04/o'); 

window.open(url)
}


 
Ashish KumarAshish Kumar
Hi Jim,

You are using window.open(url) to  open the page. It loads the page in new tab. However to open the page in the same tab you can use window.location 
window.location.href = "https://www.google.com";

Let me know if it solves the problem.

Regards,