+ Start a Discussion
chopairchopair 

Window.reload()

I have a custom button that when clicked updates a field on a case but unless you refresh the screen, you don't see update on the record.  Is there a way to add a reload funciton to my javascript that will refresh the page for me?  I am new to coding so any help would be greatfully appreciated.

My current code:

{!REQUIRESCRIPT("/soap/ajax/9.0/connection.js")}
var c = new sforce.SObject("Case");
c.Id = "{!Case.Id}";
c.JITB_Notify_Now__c = "1";
window.alert("Case has been transferred to JITB")
var result = sforce.connection.update([c]);
sfdcfoxsfdcfox
I always add the following line of code to refresh the page:

Code:
window.top.location.href = window.top.location.href;
Unless they're using some weird obsolete browser or have their browser set to never reload pages, this will reload the page using the new information.

~ sfdcfox ~
chopairchopair
This worked great, thank you.
lee.boonstralee.boonstra
I had this problem with an safe setting in Internet Explorer. To avoid this little problem, without page refreshing I wrote these lines after my <title></title> tags in the S-Control:

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">