back to blog
Deactivating Users who never logged in for more than 60 days
December 05 2023 • 15 min read

Business Challenge

In order to keep the licensing costs low, users who are not using Salesforce should be deactivated on a regular basis. Below flow can be implemented to deactivate users beyond a certain number of days of inactivity.

Steps to achieve the Requirement

Create one Text field in User object

Go to set up → Click Object Manager  →  Select User Object and then go to 

Field & Relationships.

p 1

 Select Text as a field type → Click Next

 Field Label : Note

 Length : 50

p 2

Click Next , Next & Save.

Create Schedule Triggered Flow

From the Quick find search and select Flows → Click New Flow.

p 3

Select Schedule-Triggered flow  → Click Create.

p 4

Set a schedule to run the flow.

p 5

Select User as an  Object

Select All conditions are met (AND) as a condition requirements and add the following.

            i)  IsActive - Equals- True

\ ii) UserType -Equals- Standard

p 6

Click the New Resource button on the left side of the canvas and enter the following:

API Name : lastlogindatecheck1

Data Type : Date/Time

Resource Type : Formula with Now() - 60 days

Click Done.         

Select (+) icon → Select Get Records Element.

Select User as an Object

In the Condition requirement

Choose All Conditions Are Met (AND) and add the following

 Lastlogindate - Less Than or Equal- lastlogindatecheck

 Select (+) icon → Select Loop Element to loop through all the user records.

    Add get-all-user-record in the collection variable

Click the New Resource button on the left side of the canvas and enter the following:

API Name : note.

Data Type : Text.

Default value : who didn't login for more than 60 days.

Click Done

w 2

 Select (+) icon → Select Assignment Element and assign values as shown in the picture.

 Select (+) icon → Select Update Records Element to update the records.

p 7

 Click Save and Activate the Flow

Wrapping It Up

In this blog we have explained how to deactivate a user automatically who has never logged in for more than 60 days using a Schedule Triggered flow.

Leave a Comment

Your email address will not be published

© 2023 Digital Biz Tech