+ 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. 

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'); 


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.