+ Start a Discussion
Tolga SunarTolga Sunar 

Overridden "View" button's script not being executed when navigated back to it.

Hey,

I have overridden the "View" button of an object with a Visualforce page, in which a webservice that populates a record's most fields executes, then navigates the user into the record detail page. In order to stop the expected loop behavior, I navigate as follows (in mobile):

sforce.one.navigateToURL('/{!MyObject__c.Id}?nooverride=1');

This halts the loop behavior and redirects the user after fields are populated, it's OK to this point. However, when navigating back from the detail page to this visualforce page (via device button in Android and app button in iOS), the javascript portion in it does not execute. It does when testing on desktop, but on SF1, it behaves differently as I observed in my own developer org.

I have developed a workaround for desktop so users can skip the callouts the visualforce page executes when going back from detail page to list view, but because of the reason I described above, I had to follow a totally different routine in SF1, and I'm not very comfortable with it as it leaves behind a design flaw.

Anyone else have faced this or a similiar issue? If so, how did you overcome this?

Regards
veer singhveer singh
Hi Tolga, 

I was having same issue and was looking for workaround but there is no workaround right now.

So there is one solution - 

If you need access to both the standard and custom Edit pages then consider creating a custom Edit button. Then you can remove the standard Edit button from the Page Layout and remove the override on the Edit action to resolve this issue. In this scenario you would avoid the sforce.one.editRecord function and use the sforce.one.navigateToURL function instead.
[Ref -https://help.salesforce.com/apex/HTViewSolution?id=000212844&language=en_US]

Hope this will help you.

Best Regards,
Veer
Tolga SunarTolga Sunar
Hey,

The link you shared in your post points specifically at the looping event. I suppressed it by using nooverride in sforce.one.navigateToURL command. My issue occurs when you navigate back to the visualforce page that redirects with the help of nooverride=1, after the user has just redirected by the same visualforce page. 

Your reply did not cover my exact issue, however I highly appreciate your response.

Regards