I have a custom VF page acting as a button. When the button is refreshed, a checkbox is either checked or unchecked. All that works fine, but I cannot figure out a way to reload the page after the function is called. Can anyone help? Thanks,
<script src="/soap/ajax/35.0/connection.js"/>
<script type="text/javascript">
function Escalate(){
var confirmMsg = confirm("Are you sure you want to escalate to the Client?");
var c = new sforce.SObject("Case");
if(confirmMsg == true){
c.id = "{!Case.Id}";
c.Escalate_to_Client__c = true;
sforce.connection.update([c]);
}
else{
return false;;
}
window.location.reload();
}
function Rescind(){
var confirmMsg = confirm("Are you sure you want rescind the escalation to the Client?");
var c = new sforce.SObject("Case");
if(confirmMsg == true){
c.id = "{!Case.Id}";
c.Escalate_to_Client__c = false;
sforce.connection.update([c]);
}
else{
return false;
}
window.location.reload();
}
</script>
<apex:form >
<center>
<apex:pageBlock mode="maindetail" >
<apex:pageBlockButtons location="Top" >
<div style="width:400px;">
<apex:commandButton value="Escalate To Client" onClick="Escalate()" rendered="{!IF(Case.Escalate_To_Client__c = false, TRUE,FALSE)}"/>
<apex:commandButton value="Rescind Escalation To Client" onClick="Rescind()" rendered="{!IF(Case.Escalate_To_Client__c = true, TRUE,FALSE)}"/>
</div>
</apex:PageBlockButtons>
</apex:PageBlock>
window.location.reload
towindow.top.location.reload
.