Deactivating Users who never logged in for more than 60 days

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.

Select Text as a field type → Click Next
Field Label : Note
Length : 50

Click Next , Next & Save.
Create Schedule Triggered Flow
From the Quick find search and select Flows → Click New Flow.

Select Schedule-Triggered flow → Click Create.

Set a schedule to run the flow.

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

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.

Select (+) icon → Select Assignment Element and assign values as shown in the picture.
Select (+) icon → Select Update Records Element to update the records.

Click Save and Activate the Flow
Leave a Comment
Your email address will not be published