1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Flow Finish Location = Record Created in a Flow

Discussion in 'Programming/Internet' started by TNSalesforceGuru, Oct 8, 2018.

  1. I have a basic VF page with an embedded Flow that creates an Opportunity and I just want to redirect user to the newly created Opp instead of the Account:

    <apex:page showHeader="true" sidebar="true" standardcontroller="Account">
    <flow:interview name="Opportunity_Create" finishLocation="/{!Account.Id}">
    <apex:param name="AccountID" value="{!Account.Id}"/>

    </flow:interview>
    </apex:page>


    I have tried Opportunity.ID as the finishLocation, have even tried to create a custom field on the Account and have the Flow paste the ID of the newly created Opp into that custom field, and added the field name to the finishLocation. No dice.

    Updated attempt:

    public with sharing class OppCreateController {

    public Flow.Interview.Opportunity_Create OppCreate{get;set;}

    public PageReference getBackToOpp(){
    //set the opp Id here
    if(OppCreate!= null) returnId = OppCreate.OppId;

    PageReference send = new PageReference('/' + returnId);
    send.setRedirect(true);
    return send;

    }
    }


    VF page

    <apex:page showHeader="true" sidebar="true" standardcontroller="Account" extension="OppCreateController">
    <flow:interview name="Opportunity_Create" interview="{!OppCreate}" finishLocation="{!backToOpp}" >

    <apex:param name="AccountID" value="{!Account.Id}"/>

    </flow:interview>
    </apex:page>

    Login To add answer/comment
     

Share This Page