I was working on a case where I had to empty a hidden field, save the form and refresh all without the user noticing it. In CRM 2011 you could only achieve this by doing a not so pretty refresh something like this:
function SaveAndRefresh() {
Xrm.Page.getAttribute("myAttributeName").setValue(null);
var id = Xrm.Page.data.entity.getId();
Xrm.Page.data.save();
Xrm.Utility.openEntityForm("myEntityName", id);
}
But this will cause a visual page refresh where the user will get a blank page and then the form again.
In CRM 2013 and up however you can do this:
function SaveAndRefresh() {
Xrm.Page.getAttribute("myAttributeName").setValue(null);
Xrm.Page.data.refresh(true);
}
This way the page is saved and refreshed without any visual post back effects.