function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Serhat AygünSerhat Aygün 

how to skip visualforce page when clicking back button in SF1

hi all,

I have overridden View button in a custom object, so whenever I click on a record in SF1 list view, a visualforce page is called which executes a callout to an external system and populates all the fields of the record before navigating to the detail page of it. The problem is that, when I click on the back button (top left corner of screen), I go to the visualforce page again, and I become stuck at "Please Wait" statement which it displays. My intent is to navigate back to the list view directly from the detail page, skipping the visualforce page.

I tried putting a sforce.one navigation element that redirects to the list above the sforce.one.navigateToURL but I couldn't get it to work. Anyone else got any other ideas on how I can overcome this issue?
 
<apex:page StandardController="PR_PO_Approvals__c" extensions="WSPRPOApprovals">
  <apex:form>
           <h1>Please wait...</h1>
           <apex:actionFunction name="CallDetailPRApexMethod" action="{!GetDetailPR}"
                            oncomplete="Call('{!ErrorMsg}');"/>
           <apex:actionFunction name="CallDetailPOApexMethod" action="{!GetDetailPO}"
                            oncomplete="Call('{!ErrorMsg}');"/>
 </apex:form>
<script type="text/javascript">
    try 
    {
        if ('{!PR_PO_Approvals__c.RecordType.DeveloperName}' == 'PR_LineItem'){
            CallDetailPRApexMethod();}
        else {
            CallDetailPOApexMethod();}
    } 
      catch(e) { 
      alert(e);
}
function Call(a)
{
 
    if(a)
    {
        alert (a);
    }

        if((typeof sforce != 'undefined') && sforce && (!!sforce.one)) 
        {

            sforce.one.navigateToURL('/{!PR_PO_Approvals__c.Id}?nooverride=1');
            
        }
        else 
        {          
            window.location.href = '/{!PR_PO_Approvals__c.Id}?nooverride=1';                                          
        }
          
}
</script>
</apex:page>
Best Answer chosen by Serhat Aygün
Tolga SunarTolga Sunar
Try stacking several sforce.one navigation commands for trial and error. In the past I got the same issue fixed by doing so.

All Answers

Tolga SunarTolga Sunar
Try stacking several sforce.one navigation commands for trial and error. In the past I got the same issue fixed by doing so.
This was selected as the best answer
Serhat AygünSerhat Aygün
Thanks Tolga,

its working for me,

            sforce.one.navigateToURL('/{!PR_PO_Approvals__c.Id}?nooverride=1');     
            sforce.one.navigateToList('00B240qeqeC', 'Pending Approvals', 'PR_PO_Approvals__c');
            sforce.one.navigateToList('00B240qeqeC', 'Pending Approvals', 'PR_PO_Approvals__c');
            sforce.one.navigateToURL('/{!PR_PO_Approvals__c.Id}?nooverride=1');