2

So I have a flow so that users can create cases.

In my current flow Screen Input -> record create -> Thank you screen. I want users to go back from the thank you screen and edit what they wrote without creating duplicate records, So I changed the order of operations. It would be Screen Input -> thank you -> record create. The problem with this is that my Finish_location is not working. I get the following error: enter image description here

The Visualforce page code:

<apex:page controller="Quick_Case" >
    <flow:interview name="Quick_Case" interview="{!flowInstance}" finishLocation="{!FinishLocation}" buttonLocation="bottom">
        <apex:param name="Role" value="{!$User.UserRoleId}"/>
        <apex:param name="Department" value="{!$User.Department}"/>
        <apex:param name="CurrUserID" value="{!$User.Id}"/>
    </flow:interview>
</apex:page>

The Apex Class:

public class Quick_Case {

    Public Flow.Interview.Quick_Case flowInstance{get; set;}

    Public PageReference getFinishLocation() {

        String ID = '';
        if(flowInstance != null)
            ID = flowInstance.caseid;

        PageReference send = new PageReference('/' + ID);
        send.setRedirect(true);
        return send;       
    }        
}
4
  • When you land on that error page, what is in the browser's URL string? Commented Dec 14, 2015 at 18:12
  • Also, is the caseid variable in your Flow correctly set to be of type Output? Commented Dec 14, 2015 at 18:13
  • I heard it's very cold these days in Finland, maybe that is why?
    – dzh
    Commented Dec 15, 2015 at 9:26
  • The issue I see with your code is that if the flowInstance == null then you redirect users to '/', which might navigate them away from your flow. If you want them to stay in the page for some reason, you have to return null.
    – mkorman
    Commented Dec 15, 2015 at 16:31

1 Answer 1

0

The thank you screen needs to be after the record create this causes the visualforce page to refresh and retrieve the newly generated record id. Initially it will load with a null id.

You must log in to answer this question.

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