How to write a Button URL for your Flow

So, if you read the first post on Choosing your Button, then you have already seen the ‘finished’ product of what we will be discussing in detail on this post.  If your use case does not require the need for a Visualforce Page, then a simple URL is easiest and fastest way to have your Button deployed!

Now lets take apart our URL into its most basic pieces, so that we know what builds up our URL and how we can customize it:

The Boilerplate:   ../flow/

Notice, we put “..” before /flow/, this is because if you plan on using this Button in a Salesforce Community, the URL will cut off the “/community/” and they will be sent to an error page saying the page no longer exists.

The Flow’s Unique Name: “Flow_Unique_Name”

This is your Flow’s “API” name.  This will little piece changes per flow.  Note, when you are looking for your Flow .  Note, this and your Boilerplate actually make up your Flow’s URL, which is also found on the Flow Detail page.

Before adding anything else…: “?”

You must place a “?” at the end of your Flow URL if you plan on adding anything to it.  The next two sections only work if this has been added after the Flow URL.  After this “?” if you want to add anything additional you need to use a “&”.  That is really as complicated as it gets!

Passing a variable into your Flow:  Variable_Name=Insert_Merge_Field

If you want to pass a variable into your Flow, this is the format that you will use.  You can pass more than one variable into your URL by simply adding a “&” after the first merge field.  You can see this in my screen shot at the end of this URL section

Your Flow’s Finish location: “retURL=/Insert_Merge_Field” 

You have the option to tell your Flow where you want it send the User after they finish going through all of the steps.  Use this to your advantage and don’t confuse your Users by sending them to an unrelated Object/Record!  If you want to send them to a newly created record (from within your Flow), that is currently not possible using just a URL (but we will cover a workaround in a future post).

Text of the URL:

../flow/Assign_To_Me?var_CaseId={!Case.Id}&var_UserId={!$User.Id}&retURL=/{!Case.Id}

RECAP:  Button URLs  really save you time when deploying a Flow.  The ease of not having to create a Visualforce Page is a big selling point for going this route for most situations.  Remember that your variables are case sensitive in the URL, so if something isn’t working properly check that your variable(s) match exactly!

 

5 thoughts on “How to write a Button URL for your Flow

    • David Litton June 8, 2015 / 5:23 pm

      In your FLOW, is the the variable for your Case Id “var_CaseId” or “CaseId”? In this URL it is set that your variable is named “var_CaseId”. You can either edit the URL or your FLOW, but it seems that that is where the disconnect is

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s