+ Start a Discussion
Ana K. BertuzziAna K. Bertuzzi 

Issue with Visualforce Page with both standard controller and extension (that calls a flow) - Loop

Hi everyone,

I've created a VF page with calls a flow and a controller I created to pull a variable from the flow and use it in the finishLocation.

The thing is that now I tried to map this VF page overriding a custom object's "New" button, and realized that to do so, I needed to add the standardController to that object so I can see it when trying to change my button. Then I changed the controller to extension and added the following to my class:
public MyflowController(ApexPages.StandardController stdController) {}

The thing is that after this change, when I click the finish button, instead of landing in the URL of the Record Type (variable from the flow), the flow restarts in a loop.

Is there anything that I should change in the class? or the VF page?
I don't know what I should put between the curly brackets, so I left it empty. I wonder if that is the issue. I'm not actually "getting" anything from My_Tickets__c object.

This is the VF page:
<apex:page standardController="My_Ticket__c" extensions="MyflowController" TabStyle="My_Ticket__c">
   <flow:interview name="My_Tickets" interview="{!Myflow}" finishLocation="{!LinkID}" />

And the extension:
public class MyflowController {
 public MyflowController(ApexPages.StandardController stdController) {}
   public Flow.Interview.My_Tickets Myflow {get; set;}
   public String fullURL {get; set;}
   private String Instance = null;
   private void GetURL() {
      Instance = GetInstance(Instance);
      fullURL = 'https://' + Instance + '.salesforce.com/a1G/e?retURL=%2Fa1G%2Fo&RecordType=' + RTid() + '&ent=02I400000013Z1q';
   public PageReference getLinkID() {
      PageReference p = new PageReference (fullURL);
      return p;
   public String RTid() {
      if (Myflow==null) return '';
      else return Myflow.varRecordType;
   public String GetInstance(String Instance) {
      if (Instance == null) {
          List<String> parts = System.URL.getSalesforceBaseUrl().getHost().replace('-api','').split('\\.');
          if (parts.size() == 3) Instance = parts[0];
          else if (parts.size() == 5) Instance = parts[1];
          else Instance = null;
          return Instance;

Thanks for your help!

Best Answer chosen by Ana K. Bertuzzi
TC DeveloperTC Developer
try adding ?nooverride=1'; to url 

All Answers

TC DeveloperTC Developer
try adding ?nooverride=1'; to url 
This was selected as the best answer
Ana K. BertuzziAna K. Bertuzzi
Thanks TC Developer,

It worked but I had to use & instead of ?
It took me a while to figure it out.

Best regards,

TC DeveloperTC Developer
Hi thanks I thought youmight know that . all ? is your 1st argument to the URL if you have move then use &