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
David LittonDavid Litton 

Flow FinishLocation from a Formula Field

So I created a flow.  Setup the standard button that calls on a visualforce page with the finishlocation as the original location... and it works great!  My issue is that we want this button to be in the details as a field... so I've setup that.  The flow runs fine until it gets to the end and repeats itself (and then erroring).

HYPERLINK("/flow/CSD_Activity_Flow?OpportunityId=" & Id,
IMAGE("picture", "Request a Quote"), "_self"

The VF page is setup like:

<apex:page standardController="Opportunity" sidebar="true">
  <div style="float: center; width: 700px; padding: 20px;">
      <flow:interview name="CSD_Activity_Flow" finishLocation="/{!Opportunity.id}">
        <apex:param name="OpportunityId" value="{!Opportunity.id}"/>

    </flow:interview>
  </div>
</apex:page>
Best Answer chosen by David Litton
ShashForceShashForce
Hi David,

Please change the formulas to this:

HYPERLINK("apex/vf_page_name?Id="+ Id ,"vf page", "_self")

I tested this and it works for me. Please note that you should use the vf page name and not the flow name in the formula.

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank

All Answers

ShashForceShashForce
Hi David,

Looks like you are linking the flow directly in the hyperlink formulas field, and there is no visualforce page involved in it. A flow, as per standard functionality, repeats itself. You might want to link the visualforce page instead of the flow in the hyperlink formula.

Maybe something like:

HYPERLINK("/apex/vf_page?OpportunityId=" & Id,
IMAGE("picture", "Request a Quote"), "_self"

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
David LittonDavid Litton
Thank you Shashank, that was part of the issue.  I am now however having issues after I do my first record lookup.

So when I am not using my "custom formula field" as the button and I use a standard button linked to the VF page, it takes me to this URL:

button url  /apex/CSD_Activity_Flow?scontrolCaching=1&id=0068000000ojWkZ

Now, when I do "/apex/CSD_Activity_Flow?OpportunityId=" & Id it is not taking in the Id correctly, because the record lookup sends me straight to my FAULT error screen.

So I thought I would try pasting the 'button url' into my custom field "apex/CSD_Activity_Flow?scontrolCaching=1&id=" & Id it takes me to this URL instead "/apex/CSD_Activity_Flow?id0068000000ojWkZ=&scontrolCaching=1"

Thanks again for your help so far!
David
ShashForceShashForce
Hi David,

Please change the formulas to this:

HYPERLINK("apex/vf_page_name?Id="+ Id ,"vf page", "_self")

I tested this and it works for me. Please note that you should use the vf page name and not the flow name in the formula.

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
This was selected as the best answer
David LittonDavid Litton
Thank you Shashank.  It seemed that I was using OpportunityId instead of just simply Id and that caused the issue (as well as the /flow/ problem).