I am very new to visualforce (and flow incidentally), so I'm not sure what's going wrong. I've created a new flow to create a new case. I made a new Visualforce page for the flow so that I could make a button and have the end of the flow result in going to the newly created Case.

I am including my visualforce page and controller code below. In my flow, I added a screen after the case creation that simply states "Case Created", so that the page has time to pull the flow variable that contains the new page ID. Any help or hints as to what I'm doing wrong would be greatly appreciated!

VF Page:

<apex:page standardcontroller="Contact" extensions="ContactFlowExtension" showHeader="false"     sidebar="false">
    <flow:interview name="Ticket_Creation_Flow_2_0" interview="{!flDemo}" finishLocation="{!CID}">
    <apex:param name="ContactId" value="{!contId}"/>

Controller Extension:

public class ContactFlowExtension
    private final Contact cont;

    public ContactFlowExtension(ApexPages.StandardController stdController)
        this.cont = (Contact)stdController.getRecord();

    public Flow.Interview.Ticket_Creation_Flow_2_0 flDemo { get; set; }

    public String getmyID()
        if (flDemo == null) return '';
        else return flDemo.CaseID;    

    public PageReference getCID()
        PageReference p = new PageReference(getmyID() + '/');
        return p;

    public String getContId()
        List<Contact> t = 
            SELECT Id from contact
                WHERE id =: ApexPages.currentPage().getParameters().get('id') limit 1];

        String contID = null;    
        for (Contact str : t)
            contID += str + ',';
        contId = ContId.subString(0, contID.length());
        return contId;

Edit: I forgot to include the error. I get this error once the flow completes and I click "Finish".

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. Please contact your salesforce.com Administrator for assistance.

1 Answer 1


Try this:

private String getmyId() 
        if (myId==null) return '';
            return myFlow.myID;     

//Used for Flow finish location
public PageReference getFinishPage(){
    if(myFlow <> null){
        newID = myFlow.myId;
    if(newID <> null){
        PageReference p = new PageReference('/' + newID );
        return p;
        return null;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .