Customize Login Experience using Login Flow

A login flow can be used to personalize the login experience and integrate business processes with Salesforce authentication. Common use cases include displaying release/notice messages, collecting and updating user data at login, configuring multi-factor authentication, and integrating third-party strong authentication methods.

💼 Business Use Case

When new users join Green Motor Inc., their initial profile is set to read-only; they can only read the data and cannot create or edit anything in the salesforce org. To obtain create/edit access, they must submit a ticket. Vatsala works at Green Motor Inc. as a Salesforce administrator. She received a request from a business to display a message with a link to create a ticket when Marketing profile users log in and do not have create/edit permission on the Lead object.

Advertisements

💡 Solution

Vatsala has decided to use Login Flow and Screen Flow to solve this use case. In Screen flow, she has to check the permissions for the Lead object for the user who is logging in and if the user lacks create/edit permission, screen flow should display a message to the user.

Create a Screen Flow

1️⃣ Goto Setup > Home and click on the create action dropdown and select Flow.

Select Screen flow and click on create button.

2️⃣ Add the Get Records element and get the Permission Set Assignment object entry for the user.

Click on the Done button.

3️⃣ Add the Loop element and select “Get_Permissionset_assignment” collection variable.

4️⃣ Create a collection variable resource called PermissionSetIDs

5️⃣ Put the Permission Set IDs in this variable from the loop element.

Inside the loop element click on the (+) plus icon and add an Assignment element. Select the PermissionSetIDs in the variable field, select Add in the operator, and select PermissionSet ID from the loop element.

6️⃣ Add Get Records outside for loop and get the Object Permissions record.

Filter ① Used to filter the object.

Filter ② IN operator (Winter’23 feature) is used to filter the records based on PermissionSetID.

7️⃣ Add a Decision element and set the condition as shown in the screenshot below.

8️⃣ In the TRUE outcome (path) add a Screen element and put the Display Text component on the screen. Put the message in the rich text field shown on the right-hand side.

DONE ! 🎉 The final flow will look like the screenshot below.

Now go to Setup and search ‘Login Flow’ in the quick find search box. Click on Login Flow.

✷ Click on the New button.

✷ Select Flow in the Type field.

✷ Enter the Name of the Login Flow.

✷ Select your screen flow in the Flow picklist field.

✷ Select User License as Salesforce.

✷ Select Profile as ReadOnly.

✷ Click on the Save button.

When new marketing user logs in with a read-only profile, they will see this message in the login process.

Advertisements

Summary

A login flow allows you to manage the business processes that your users go through when they login to Salesforce. The login flow directs the user through a process after Salesforce authenticates the user, such as enforcing strong authentication or collecting user information. When users successfully complete the login flow, they are redirected to their Salesforce org or site. If the flow fails, users will be logged out immediately.

I’d like to hear from you!

What did you take away from this post? How do you intend to apply your newfound knowledge in the real world? Please share your thoughts in the comments section below.

Please rate our website(required)

Join 153 other subscribers
Advertisements
Advertisements

Arun Kumar

Arun Kumar is a Certified Salesforce developer and Salesforce Champions (Platform Champions), a Computer Science graduate, working on the Salesforce platform and providing customer solutions using force.com as a Salesforce consultant/developer. He is the founder of SFDCLessons. :)

Leave a Reply