Use Case: Deactivate Users with The Last Login Date

We have utilized the Schedule-Triggered flow to automate sending the emails. Now, we want to show you how to use Schedule-Triggered flow to automatically deactivate the users! In Flow Builder, there is a standard field for the User object called “Last Login Date“. This field makes the solution very easy to build, so let’s dive in!

* Big thanks to Gustavo Seluja for sending in the case!

Lulu Mobile wants to automate their user management. If a user hasn’t logged in for the past 90 days, they want to deactivate this user automatically. At the same time, they want to add a note of “90 Days No Login” in their custom Note field.

(Assumption: There is a “Note” text field on the User object)

We will use the Schedule-Triggered flow. In the automate email post, we created a formula field and let it run daily. However, we cannot do the same for the User object because we can only reference the Last Login Date in Flow Builder but not in the formula field. So instead of evaluating the last login date in Choose Object and Filter Conditions, we will use a Decision element to do so.

This means, whenever the flow runs, all active users will be included in the flow. Thus, I will recommend running this flow weekly instead. Of course if you believe your instance has enough capacity and you don’t have too many users, you can still run this daily.

Flow Chart (deactivate last login date)

Steps (deactivate last login date)

Please wait while flipbook is loading. For more related info, FAQs and issues please refer to DearFlip WordPress Flipbook Plugin Help documentation.

Schedule-Triggered FlowGet RecordsUpdate RecordsAssignment
FormulaDecision

Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!

Official Salesforce Help Article On Flow

Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Gustavo Seluja

Melody: you nailed it. Beautiful. I tested it today. Thank you!!!!!!

Users inactivated with a flow.jpg
Afshar

Hi Melody,

I tried replicating the steps you provided but it didn’t work for me.
I got the following error: Failed to update records whose IDs are in {!$Record}.

I’d appreciate your help.

Here are the screenshots:
https://picd.in/IqJ7kfFm
https://picd.in/sBJ0VuwB
https://picd.in/onSTaraL
https://picd.in/NS2E4DqT
https://picd.in/CAUbY6pN
https://picd.in/bA9yYwz8
https://picd.in/IpT8dEil

Thanks!

Screen Shot 2021-07-27 at 12.19.22 PM.png
Afshar

Thank you so much for replying.

Although, this time states as completed I still got the same error regarding the login date null.

Skipped this outcome because its conditions weren’t met: Last_Login_90_days_ago.

https://picd.in/c1X2N8h7
https://picd.in/rjRkqZS4

Screen Shot 2021-07-28 at 1.10.09 AM.png