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
Sean M 3Sean M 3 

Salesforce Mobile App Flow Redirect

Hi all,

I have implemented a custom button in Salesforce which when pressed triggers a flow:


The flow creates the record then redirects to the record page via visualforce & Apex:
<apex:page controller="FlowRedirectController" action="{!FlowRedirectController}">
public with sharing class FlowRedirectController {

    public Object FlowRedirectController() { 
        String unique_id = ApexPages.currentPage().getParameters().get('id');
        String url;
        if(unique_id == null){
            // Return Home if no ID 
            url = '/home/home.jsp';
            return new PageReference(url);
            Id orderId;
                // Get Order ID and set Redirect 
                orderId = [ SELECT  Name,
                        FROM Order  
                        WHERE Unique_Flow_Identifier__c = :unique_id 
                        ORDER BY CreatedDate DESC   
                        LIMIT 1].Id;
                // Redirect to ORder 
                url = '/' + String.valueOf(orderId);
            }catch(exception e){
                system.debug('FlowRedirectController.orderId is blank + ' + e);
            // Did we find a Order? 
            if (orderId == null) {
            // Return Home if no ID 
            url = '/home/home.jsp'; 
        return new PageReference(url);

So it all works fine in Classic/Lightning however on the mobile app it redirects to login page when pressing button. Any ideas on how to fix this?

p.s. yes I have ticked the available for lightning box on vf page.