Super Admin

Block users from Logging into Salesforce during Deployments

Pinterest LinkedIn Tumblr

 Block users from Logging into Salesforce during Deployments

In this post, We will try to understand how to stop users from logging into Salesforce when deployments are going on. Have you ever wondered how salesforce displays a maintenance message to users? The answer to this question is Salesforce uses Login flows to display message to users. Lets see how we could use Login flows, Flows and Custom settings(Hierarchical) together to stop users from Logging into Salesforce during deployments.

Step 1: Creation of Custom settings

Create Custom settings with the desired name and for our demo purpose, we will call it Block users from Login. We need to create two fields (BlockUser and DisplayMessage) on the “Block users from Login” custom settings. Block user field will be a checkbox and the Display Message will be a text area field. If the checkbox is selected then the desired message from the Display Message field should be displayed to the users

Step 2: Creation of flow

Create a flow with the desired name. For demo purposes, we will call it as “Block users from Login Service”.

Get Records: From Left side, pane select Get records and drop it on to the main page. In this step, we are trying to get the records from our custom settings(Block users from Login) as shown in the image. Fill in all the mandatory fields and select the first record

Object – Block users from Login

Condition Requirements — Get all Block users from Login

Sort Order – Not Sort

How many records to store – only the first record

How to store the record data – Choose fields and assign Variables (Advanced)

Select Variable to Store Block users from Login

Record – {!blockusers}

Field – BlockUser__c

Field – DisplayMessage__c

After entering all the above information click on Done. With this activity, we have successfully created Get Records.

In the next step, we will try to check if the Block user field on the fetched Custom setting(Block users from Login) is set to true using the decision box.

Decision:: Drag and drop Decision box from Left palette onto the Main page.Enter the desired Label and API Name. In the outcome, order click on + and enter the below details. Give the desired Label and API Name and set the When to execute Outcome as “All conditions are Met”. In the Resource select the blockuser field as true using the Global constant field. Click on Save and connect Get Records with decision box.

Screen: From the Left palette select the Screen and drop it on the main page. Give the desired screen name on the Label/API Name in the Screen properties. In the configure frame select “Show Header” only.

Note: Make sure you unselect the “Show footer” or else users will be able to see a button and then navigate/login to salesforce.

Our end result of the flow should be as shown below and make sure you go back and activate your flow.

Login flows:

Create new Login flow with desired name and select the flow we have created(Block_users_from_Login_Service).  Select userlicense as Salesforce and set the desired profile that we want to block the users from Logging in. In my scenario, I wanted to block Users with Standard User profile from logging into Salesforce.


Login with any  Standard profile user and we should be able to see the information message from our custom settings and stop users from navigating into salesforce.

Note: Once the deployment/Maintenance is complete make sure to uncheck the Blockuser__c field to allow users into salesforce

Write A Comment