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
ArchieComArchieCom 

Redirect Page not working correctly without the end screen

 

Hello,

I have a visual workflow, where I post some questions (Yes or No type in a radio button). Now depending on the answers to the questions, the decision path redirects to different path where we assign a variable to be true or false. So the visual workflow just has a screen, a decision and assignment elements for both the paths. I do not have an end screen element. Now, I am redirecting to different pages based on the value and this is not working if I do not have the end screen (if works if I have the extra end screen). I do not want a unnecessary end screen for my flow. How can I achieve this?

 

My VF page code is:
:

<apex:page sidebar="false" controller="PGIPathDeciderController" >
  <flow:interview name="TestPath" interview="{!aFlow}" finishLocation="{!FinishPage}">
      <apex:param name="FlowQuoteID" value="{!quoteId}"/>
  </flow:interview>
</apex:page>

 

My controller code is:

public class PGIPathDeciderController
{
public Quote theQuote {get; set;}
public Flow.Interview.TestPath aFlow {get; set;}
public String quoteId {get; set;}

    public PGIPathDeciderController ()
    {   
        Id id = ApexPages.currentPage().getParameters().get('Id');
        if(id != null)
        {
            quoteId = id;
            theQuote = [SELECT Name, BillingName, BillingStreet, BillingCity, BillingState, BillingCountry,
                             BillingPostalCode, Phone, Status, Id,
                             Opportunity.Account.Id, Account__c, OpportunityId, isConfigureCompany__c
                    FROM Quote WHERE Id = :quoteId LIMIT 1];
        }
    }
    
    public boolean getRedirectFlag()
    {
        if (aFlow == null)
        {
        return false;
        }
        else
        {
            return aFlow.redirectPath;
        }
    }

    public PageReference getFinishPage()
    {
    system.debug('aFlow' + aFlow);
    PageReference prEdit;
        if (getRedirectFlag())
        {
           prEdit = Page.PGICompaniesAndContacts;
           prEdit.getParameters().put('id', theQuote.ID);
           prEdit.setRedirect(true);
        }
        else
        {
            prEdit = new ApexPages.StandardController(theQuote).view();
            prEdit .setRedirect(true);
        }
        return prEdit ;
    }

}

Thanks!

All Answers

RajaramRajaram
Thanks Darrell, as always for the update. This is a limitation we are aware of and the workaround is to put a screen at the end.
ArchieComArchieCom

 

Thanks for the update.