Flow Finish Location – You can’t get there from here! 3

Have you ever created a flow and wanted to navigate the user to the newly created record but couldn’t quite figure out how to get them there? Being fairly new to flow, I attempted to do this with an autolaunch flow and ended up feeling like the image in Andrew Boettcher‘s blog, Flow and FinishLocation. After reading his blog, along with many question and answer forums, it became clear that it is impossible at this point in time. Andrew’s explanation of why a screen is required along with finding this known issue, finally convinced me to add a screen.

Of course, that was just the first obstacle I ran into, next I had to figure out how to test the extension. Since a screen is required, you cannot truly test the flow but you need code coverage in order to deploy, so now what? Admittedly, I was attempting to answer a question on the Salesforce StackExchange and got close, but it was sfdcfox suggestion of using ternary that got it all the way to 100%. The following example uses a button to call a flow that creates a contact based on the Account using a button and returns the user to the Contact page.

The Visualforce Page:

The Extension:

The Test:

Getting to 100% code coverage for the sake of code coverage, isn’t best practice, but for now it’ll have to do. At least until this idea, requesting the ablility to set the finish location dynamically in the flow, gets implemented. If you find yourself setting the finishLocation for multiple flows, take a look at codefriar‘s blog, A reusable Redirect controller for VisualFlows.

Leave a comment

Your email address will not be published. Required fields are marked *

3 thoughts on “Flow Finish Location – You can’t get there from here!