[SalesForce] Redirecting in flow without code

I am trying to redirect my flow back to a standard page using this

<apex:page standardController="Opportunity" >
    <flow:interview name="My_First_Flow_New_Primary_Contact"
                    finishLocation="{!URLENCODE($CurrentPage.parameters.vOpportunityId)}">
        </flow:interview>
</apex:page>

But it gives this 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. Please contact your salesforce.com Administrator for assistance.
Click here to return to the previous page.

Is there anyway round this error message?

The following works fine from a custom button, but read retURL is unreliable.

https://eu3.salesforce.com/flow/My_First_Flow_New_Primary_Contact?vAccountId={!Opportunity.AccountId}&vOpportunityId={!Opportunity.Id}&retURL=/{!Opportunity.Id}

I would have thought directing should be handled in the flow entirely – have I missed something?

Best Answer

Got it this time.

Change the button to open the VisualForce page and then use this

<apex:page standardController="Opportunity" >
<flow:interview name="My_First_Flow_New_Primary_Contact"
                finishLocation="/{!Opportunity.Id}">
                  <apex:param name="vAccountId" value="{!Opportunity.AccountId}"/>
                  <apex:param name="vOpportunityId" value="{!Opportunity.Id}"/>

    </flow:interview>

Related Topic