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
John Smith 266John Smith 266 

Apex help needed for flow finish location

I am trying to set the Finish Location for my flow to either go to the detail page of the Opp created by the flow or reload the flow. My VF page and Apex controller are below. I'm getting an error: "Invalid Page Redirection.  The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button."
 
When I hard code the PageReference to ('/' + anExistingOppID), then it redirects to that record just fine. So I know the issue is with my getFinishURL() method. The flow variable that is supposed to be pulled is either the newly created record ID or the URL for the visualforce tab that houses the flow. I added a troubleshooting screen to the flow to see the variable value assignment and it looks correct to me. 
 
Any ideas what I might be missing?
 
Controller:
public class MemberPaymentFinishController {
    public Flow.Interview.Manual_Membership_Payment theFlow {get; set;}
 
    public String getFinishURL() {
    String FinishURL;
      if (theFlow==null) return '';
      else FinishURL = (string) theFlow.getVariableValue('varFinishID');
      return(FinishURL);
      }
 
    public PageReference getFinishPage(){
            PageReference p = new PageReference('/' +  getFinishURL() );
            return p;
}
}
 
VF page
<apex:page Controller="MemberPaymentFinishController" > <br/> <flow:interview name="Manual_Membership_Payment" finishlocation="{!FinishPage}" /> </apex:page>
DixitDixit
if you debbug the "FinishURL" string, is it bringing the correct value?