I am stuck in a situation, hope so I could get some help here.
I'm having a condition where I want to redirect a page to one URL. It is related to service cloud console.
In controller I defined a merge variable :
public string finalURL {get; set;}
VF page :
<apex:commandButton action="{!save}" value="Save" onComplete="refreshTab({!isError});"/>
and I am using this memebr variable in Javascript.
Javascript code :
<script type="text/javascript">
function refreshTab(isError) {
if (!isError) {
sforce.console.getEnclosingPrimaryTabId(refreshTabById);
}
}
function refreshTabById(tabId) {
if(sforce && sforce.console && sforce.console.isInConsole()) {
sforce.console.refreshPrimaryTabById(tabId.id, true);
} else {
var urlString = {!finalURL}; //'https://cs14.salesforce.com/1234'
window.location = urlString;
}
}
</script>
But, the issue is, when code is coming to the else condition, the page is not redirecting to the new URL defined. Any idea?