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
Aman PathakAman Pathak 

Is there any way to redirect to new created opportunity from flow in salesforce1 app?

hi I have a flow which convert lead (basically for screen with details of lead) for salesforce1 app.
this is working fine for desktop version but  for SF1 app it is not working, I am getting an opportunity Id after conversion.

VWFConvertLead is the pluging I am using in the flow .
things I have done:

  • Implemeted the flow using the plugin. 
    <apex:page standardController="lead" showQuickActionVfHeader="false" extensions="FlowLEadConvertExtension" lightningStylesheets="true">
        <script  type="text/javascript">
        function getopp(){
            var opIdgenerated ="{!opid}";
            console.log('opIdgenerated'+opIdgenerated);
            if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
                 // Salesforce app navigation
                 sforce.one.navigateToSObject(opIdgenerated);
                 }
            else
                {
                    console.log('in else');
                }
                
            }
        </script>
        
        <apex:slds />
        <flow:interview name="SAMPLE_Lead_Convert_Flow" interview="{!myAutoFlow}"  buttonLocation="bottom" finishLocation="{!nextpage}">
                    <apex:param name="recordId" value="{!Lead.Id}"/>
           
                </flow:interview>
    </apex:page>

     
  • embedded the flow in the visualforce.
  • called the visualforce page from an actin
  • used pagerefernce to go to the created opportunity.
    public class FlowLEadConvertExtension {
    
        Public Flow.Interview.SAMPLE_Lead_Convert_Flow myAutoFlow { get; set; }
        Public FlowLEadConvertExtension(ApexPages.standardController controller) {}
       public static string opid{get;set;}
        Public String getmyID() {
            if (myAutoFlow==null)
                return '';
            Else
                opid=myAutoFlow.vaOpportunityId;
                return myAutoFlow.vaOpportunityId;
            }
      
        Public PageReference getNextPage(){     
        PageReference p = new PageReference('/' + getmyID() );
        p.setRedirect(true);
        return p;
        }
    }