I have a detail page button which calls a webservice class. Its some thing like:

sforce.apex.execute(Class, method, {paramName : Param}, { onSuccess: success, onFailure : failure});

I need to refresh the entire detail page on complete of the total execution. Is there a way to achieve it? Are there any callbacks for onComplete also?

Kindly help.


2 Answers 2


onSuccess and onFailure are called on completion of the action, so simply add a line to the definitions of your success and failure functions.

window.location.href = window.location.href;

Is this button on a standard or custom Visualforce page?

In your apex class you can try to redirect back to your detail page provided you have a reference to a record.

For example, to redirect back to the Account detail page you would do:

PageReference p = new Apexpages.Standardcontroller(account).view();


return p;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .