 Hello, everyone. I am Sanjay Gupta. I welcome you on Sanjay Gupta Tech School. In this video, I'm going to demonstrate you how you can use login flow in Salesforce. Let's understand the requirement of login flow. So we need to create a login flow, which will check whether user accepted terms and condition at the time of login or not. So I'm jumping into the org. So what we are going to do, we will be having a checkbox. So I'm going to show you on the user object. I already created a checkbox. So here you can see I have created a checkbox that is terms and condition accepted. So initially it is false, right? So whenever a user logs in. So our flow will be checking whether this checkbox is checked or not. If it is not checked, then a login flow will be there at the time of login and it will ask user to like, do you agree with terms and conditions or not? If user checks that checkbox, then this checkbox will be checked and on the next login that flow won't be launched, right? So now I'm taking you to set up where we can search login flow. So here login flows option is available and here you can see we can create new login flow. So you just need to click on new and from here you can select flow. If you have visual for space created, so you can select that as well. But in this demonstration, I'm just going to use flow on it. So I need to select the flow. Then here I need to provide the type then flow. So I also need to create a screen flow that we can link here. Then user license you can select Salesforce or maybe other licenses with which you want to connect us. So based on your license, you can select particular profile. So let's say we select standard user profile. So now if standard user profile user locks in, then only that particular flow will be launched. And if you want to render flowing lightning runtime, you can enable this checkbox, right? So I'm just canceling it as of now. So first let's see how we can implement a screen flow. So because after creation of the screen screen flow, you can only will be able to link your screen flow with the login flow. So just I'm opening this as I already created it. So I'm going to open each and every element and we'll show you so that you can also implement it in your org. So this is a simple screen flow. So first I created this decision. If I open this, so here you can see the label is check terms and condition. Then I have one outcome that is not accepted. And here I have used this dollar user dot terms and condition accepted, right? So you can simply type, I'm typing it again. So dollar user. So this is a global variable which will give you the information of currently logged in user. So you can select it and then you can search for terms and condition accepted. So this is a field which I already created in the org, right? So initially it will be false for the first time. So if it is false, then we need to move here on this direction. Then here we have this screen which will be having this display text. So this is a display text which you can search here. You can just click and have it here. Then put an API name and then the label or the message that you want to display. Then this is a checkbox which also you can search here, right? So click on this checkbox. It will be available here. Put a label. API will be populated automatically. So this way the screen will be created. So right now, okay. So after this login, I just need to have one more condition. So I just need to put one condition here. So we need to check whether user agreed or not. So if this checkbox is equals to true, it means user agreed. So in that case only we need to update the user that part, right? So you just need to apply this checkbox, which will check the user's response, which we are receiving here. And if I open this, so this is update record element, which will update the user record, which user record currently logged in user's record. So this way we provided the condition and we need to put true in this checkbox so that when second time user logs in, so this checkbox will be true. So your screen flow or login flow will not be launched. So it will be launched, but won't be visible on the UI, right? So now I'm going to save as and activate right now coming here. So I'm just deleting it so that I can recreate it for you. So I'm clicking on new selecting flow. Now here I am labeling it as terms and condition then terms underscore condition flow user license. I'm selecting a salesforce profile. I'm selecting standard user and this checkbox and I'm clicking on save, right? So this way this login flow is connected with the standard user profile. So every time whenever a user that is related to standard user profile logs in. So in that case your login flow will be launched. So what we need to do, we need to search for the user now. So here I have a user. So I'm just copying the username so that I can log in and I already know the password. So if you don't know the password, you can reset and set the password, then you can try it. And here on this record, you can see this checkbox is already checked. So I just need to edit it. And initially I am marking it unchecked. So right now it is unchecked. Right. So now I'm going to log out. In your case, maybe initially this will be unchecked by default because I just did some demonstration. That's why it was already checked. So now it is unchecked. I'm logging out. So I'm going to log in with this user username and password. And here at the time of login, you can see our login flow is there. So do you agree with terms and conditions? So here we have this checkbox next button. If you want to remove this pause button, so this is possible. So what you can do, open your screen. Okay. So right now, like we are logged out, so we won't be able to modify it through system admin. So I will show you that later on. So right now what I'm going to do, I'm just clicking on next without enabling this checkbox. So that I will again log out and we'll show you by logging in, like whether this screen flow or this login flow is launching or not. So if we keep it unchecked, so it will be launched again. So I clicked on next. So right now I am logged in as my another user. So here you can see now I am logging out again. And I'm going to log in again. So again, you can see this login flow is launching. So if I enable this checkbox, click on next. So this time again, I'm going to log out and again, I will be logging in with same user. But this time you will see that login flow won't be launched. So you can see you might have noticed that your flow finished that masses was coming, but it was finished because that checkbox was already checked. When we did attempt second time. So first time login flow launched, and it was displaying on the UI. Second time also login flow launched and it was displaying on UI. But third time login flow launched, but it doesn't didn't display the screen on the layout because that checkbox was already checked. Now I'm going to log out. And I will be going to log in with my system admin user so that I can show you that user record as well as how we can remove that pause button from the floor. So if I go to users, so here you can see this is now checked. This is checked. That is why so I'm just refreshing it. Okay, I need to open that flow again. So it is opening the version one. I'm going back. So if you want to open different versions, so what you can do click on this button view details and versions. So our latest version was version three. So we need to open that. So version three is activated. So I'm going to open it. So here you can see we are checking this checkbox which we are receiving here. If it is checked, then only this condition will be true. And then only user record will be updated and once it is updated. So this field will be having the value as true. So once all these parts are executed then next time when user will be logging in. So user won't see that screen. Your flow will launch but user won't see the screen. Right now from screen if you want to remove this pause button. So you can configure the footer and you can just hide the possible. So only finish button will be there. So this way I just demonstrated you how you can configure your login flows and also remember the requirement of login flows. So I'm just going to show you that one more time. You can manage your login flows through this. You can use login flows to introduce business processes during login such as to prompt for multi-factor identification, accept terms of service or collect information about the user. After user complete the login flow they are logged in. This space lists available login flows and the user profile associated with each right. So this you need to take care while implementing login flows in Salesforce.