Improve Your UX With Login Flows

Raise your hand if you’ve ever had to communicate a down time for a deployment to your users or struggled to distribute documentation for a new custom object in a way that was guaranteed to reach all of your users. Did you know you can change the login behavior for users using Visual Workflow (Flows)? The drag-and-drop interface makes it very easy to use, and the possibilities are endless. Today, we’ll review the basics of setting up a Login Flow and some use cases that you can set up in just a few hours!


If you’ve used Visual Workflow in the past, you know that it’s one of Salesforce’s great declarative automation tools (if not, check out the Trailhead module). While building a Flow can take some extensive trial and error, the breadth of potential is worth it. As we go through each use case, we’ll discuss one possible design for the solution. Please note that this might not be the only way to accomplish these goals.

Use Case 1: Display a message to Users – We’re Changing Our Domain

This is an excellent example to follow last week’s post on implementing My Domain. As part of the implementation strategy we outlined, we strongly recommend a thorough communication plan. One way to do this is to display a message through a Login Flow. For this example, let’s say that we want to show this message only when the Last Login is greater than 30 days ago.

To start, we’ll use a Record Lookup block to find the Last Login date for the user. In a Login Flow, we can use a formula field to access information on the running user with the {$User.APINameofField} notation. We can query the Last Login of the user in one block (below) and assign it to a variable.

lastLoginQueryBlockWe can then use a Decision block to set the criteria for behavior. We can set a parameter for UserLastLogin (our variable for the LastLoginDate of the running user) before 30 days ago, which becomes our defined outcome. Our last block will be a screen that will contain our message to users. When we connect the decision to the screen block, we’ll choose our defined outcome only; this way, when our users don’t meet the criteria, they will escape the Flow and have a normal login experience.

When we’ve finished building and activating our Flow, navigate to the Login Flows page in Salesforce under the Setup menu. You’ll then define the Flow that will be run for a specific Profile. One Flow can be assigned to multiple Profiles, but each Profile can have only one assigned Login Flow. Check out your slick finished product – now you know that your users will see the notification when they log in.


Use Case 2: Setting Finish Location – Check on Your Oldest Open Opportunity

Our second use case will help point users to a specific page or record in Salesforce. This could be used to direct users to a Visualforce Page or record. As an example, we will have users land on the Opportunity that was edited the longest time ago and is still open.

Our first step will be to query all open Opportunities where the OwnerID is the RunningUserID, and sort them in ascending order by LastModifiedDate. We’ll assign the Record Id to a variable called OppID and create a formula of type Text called FinishFormula: “/”&{!OppID}. Using an Assignment block, we will create a variable called LoginFlow_FinishLocation and set it to the FinishFormula. Lastly, let’s add a screen block to let the users know that they’ll be directed to their oldest open Opp. There you have it – an easy way to drive your users to update Opportunities before they go stale!


These are just a few use cases for Login Flows. While these are on the simple side, you can add more logic to give your users the best experience possible. By directing users to what they need most and keeping them informed, you’ll be giving them everything they need to succeed. You’ll be a hero!

If you’re interested in Login Flows, we’ll be publishing more use cases in a later post. Thanks for reading! Have another topic you’d like to see in the future? Send us a tweet! @BeardforceTyler  


Leave a Reply

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

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s