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
Jenifer Alonzo 23Jenifer Alonzo 23 

Finish Location

I am new to both Salesforce and coding. My users want their flows to end at the records that the flows create. I am trying to implement Code Friar's reuseable solution to ending flows on the record just created using Visualforce (https://codefriar.com/2014/04/18/a-reusable-redirect-controller-for-visualflows/)  The istructions say that I  need to create a flow with a decision element called "RedirectFlow" to launch the procss, but I have no idea how I am supposed to configure the decision element within the flow. I suspect I also need to plug more info into the VP page?  I appreciate any help and Many Thanks.

Here's the VF page:
<apex:page Controller="FlowRedirectController">
	<flow:interview name="RedirectFlow" interview="{!redirectTo}" finishLocation="{!finishLocation}" >
		<!-- This Parameter is *required!* -->
		<apex:param name="StartFlow" value="Convert_case_to_Contact" />
		<!-- 
		Any Params you need to pass into your flow.
		<apex:param name="CaseId" value="{!CaseId}"/> 
		-->
	</flow:interview>
</apex:page>
Here's the controller:
Public class FlowRedirectController{
	Public Flow.Interview.RedirectFlow redirectTo {get; set;}

	public FlowRedirectController() {
	    Map<String, Object> forTestingPurposes = new Map<String, Object>();
	    forTestingPurposes.put('newEnrollment','https://louisvilleurbanleague--workforce.lightning.force.com/');
	    redirectTo = new Flow.Interview.RedirectFlow(forTestingPurposes);
	}

	Public PageReference getFinishLocation(){
	  	String finishLocation;
		if(redirectTo != null) {
			finishLocation = (string) redirectTo.getVariableValue('vFinishLocation');
		}
		PageReference send = new PageReference('/' + finishLocation);
		send.setRedirect(true);
		return send;
	}
}