A few years back I wrote an article Unconventional application of Two-factor Authentication!. It was a huge success – I received several emails from people requesting me to write another article to show something on restricting login flow to once, based on the condition; instead of, running the flow more than once. Before we move ahead, do check out this article to learn about Lightning Flow Designer and some hidden tips and tricks.
Login flow gives you the flexibility to build a custom post-authentication process that meets your business requirements. Login Flow, however, doesn’t give you the flexibility to define how many times, or when, you want to display the Flow. And sometimes, this creates a problem for newbie flow learners. Newbies don’t understand how to configure Login Flow to execute only once; or, control the execution based on specific requirement – For instance, configuring how to display a message three times using Login Flow with two days gap between each display:
- Display message once in a day.
- And, there should be two days gap between the display of each message.
Today, in this article, I am going to show you how you can configure to control the Login Flow to execute only once. Let us start with a business use case.
Business Use Case
Martin Jones is working as a System Administrator at Gurukul on Cloud (GoC). GoC is in the process of updating the employment agreement. Management at GoC wants to use Salesforce to make sure that every user reads the employee agreement and agrees to it. Until they agree, don’t allow them to login into Salesforce.
Solution for the above business requirement
To solve this requirement, we will use many ingredients – including, Lightning Flow, Login Flow, and a Custom field (Employment_Agreement__c) on the User object. Before trying to understand the technical aspect of the solution, let us spend some time to understand the general flow of our solution at a very high level. Please spend few minutes to go through the following flow diagram and understand it. Read the rest of this entry!