Check this code,I have added this as publisher action on opportunities. When I press cancel button it works for the first time – takes me to opportunity detail page. But when I try again – I stay at the same page and the navigation doesnt work.
Any help would be greatly appreciated.
function myCloseWindow() {
if ( (typeof window.sforce != 'undefined') && (window.sforce!=null) && (sforce.one != null) ) {
sforce.one.navigateToURL('/006XXXXXXXXX');
}
}
</script>
<apex:form>
<apex:commandbutton value="cancel" onclick="myCloseWindow();"/>
</apex:form>
navigateToSObject
.