2

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.

This flow is launched from a custom VF tab, searches for a contact, collects info for a membership payment opp, creates the opp, modifies membership fields on the contact then restarts the flow at finish. I'm trying to modify it to either go back to the beginning or go to the OppID of the created membership. VarFinishID either houses the ID of the opp created or the url of the flow based on a screen choice.

Any ideas what I might be missing?

edited 2/10/17

Controller:

public class MemberPaymentFinishController {
    public Flow.Interview.Manual_Membership_Payment theFlow {get; set;}


    public String getFinishURL() {
    String FinishURL;
      if (theFlow==null) return '';
      else FinishURL = (theFlow.varFinishID); 
      return(FinishURL);   
      }

    public PageReference getFinishPage(){
            PageReference p = new PageReference('/' +  getFinishURL());
            return p;
    }

}

This VF page code results in Internal Server Error:

<apex:page Controller="MemberPaymentFinishController" >
    <flow:interview name="Manual_Membership_Payment" interview="{!theFlow}" finishlocation="{!FinishPage}" />
</apex:page>

This VF page code results in the flow just looping back to the start after the finish screen (I confirmed that varFinishID value set at the time of finish to a valid 18 digit Opp ID).

<apex:page Controller="MemberPaymentFinishController" >
    <flow:interview name="Manual_Membership_Payment" finishlocation="{!FinishPage}" />
</apex:page>

Troubleshooting tried: - eliminating the getFinishURL() method altogether and simplifying controller to the following - which results in a loop back to the start

public class MemberPaymentFinishController {

    public Flow.Interview.Manual_Membership_Payment theFlow {get; set;}

    public String getFinishPage(){
          if(theFlow == null){
            return null;
          }else{
          return ('/' +  theFlow.varFinishID );
          }          
    }
}

This is driving me absolutely crazy! I've looked at various finishlocation examples and it looks like I've got this coded the same as others who are having success... Either one of these controllers should work...

  • Comments are not for extended discussion; this conversation has been moved to chat, where you should feel free to further discuss! – Adrian Larson Feb 10 '17 at 20:27
  • Adrian - If the comments aren't for discussing the question ... what are they for?? – John Smith Feb 10 '17 at 21:48
  • See How do comments work? Comments were always meant to be temporary, and you can still see the entire conversation in the linked chat room. When a conversation gets very long, it ceases to add value and just becomes noise. And that sort of conversation is what chat was designed for. – Adrian Larson Feb 10 '17 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.