I have a problem with Salesforce1 app. I enable the visualforce option to use it in Salesforce1 but when I am using the app and I click in 'Back' Button the app shows the standard navigator view instead de app view (I have attached two images to understand the problem). What can I do?

<apex:page standardController="Opportunity" extensions="CnSendEmailOferta" showHeader="true" sidebar="true">
<apex:form >

    <apex:outputPanel layout="block" style="font-size: 16pt;color:red;" rendered="{!errorValidacion}">
     Los campos 'Tipo de Oferta', 'Probabilidad de compra','Probabilidad de venta' 'Equipos a ofertar',
        'Fecha de entrada' y 'Limite de presentacion' son obligatorios

    <apex:outputPanel layout="block" style="font-size: 16pt;" rendered="{!NOT(errorValidacion)}">
    ¿Está seguro que desea enviar el mail?<br></br>

    <apex:commandButton action="{!back}" value="Volver" style="margin-right:30px;margin-top:50px;"/>
    <apex:commandButton action="{!sendEmail}" value="Send" rendered="{!NOT(errorValidacion)}"/>



public PageReference back(){
    PageReference pageRef     = new PageReference(host());
    return pageRef;

private String host(){
    String salesforceHost     =  System.Url.getSalesforceBaseURL().toExternalForm();
    String url                =  salesforceHost + '/'+opp.id;  
    return url;     

enter image description here enter image description here


For salesforce 1 app ,the way you want to keep the navigation will be using Sforce functions and not use apex pagereference .

With apex pagereference the page navigates to outside the SF1 container leading you to the desktop page .

Take a look at recommended approach .The functions are documented here

You will use navigateToSObject(​recordId​[, view]) or navigateToURL(​url​[, isredirect])

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.