Toggle Side Panel

  • Blogs
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How can we inactivate users who have not logged in last 120 days?

    Tagged: Admin, Administration Setup, User, User Profile

    • Salesforce® Discussions

      How can we inactivate users who have not logged in last 120 days?

      Posted by Himanshu on April 30, 2016 at 5:45 PM
      Abhinav replied 10 years, 3 months ago 2 Members · 1 Reply
      • Admin
      • Administration Setup
      • User
      • User Profile
    • 1 Reply
    • Abhinav

      Member
      May 27, 2016 at 1:33 PM

      Hi Himanshu,

      List<User> usersToUpdate = new List<User>();
      for(User u : [Select id, IsActive from User where isActive=true and lastLoginDate <= :DATE.TODAY()-120]){
      u.IsActive = false;
      usersToUpdate.add(u);
      }

      if (usersToUpdate.size()>0){
      update usersToUpdate;
      }

      There are some limitation to do this:

      1.Cannot deactivate self user record.

      2.Cannot deactivate a user record which is referenced in another user record in a hierarchy custom field.

      3.Make a Schedule Class apex and invoke via schedule UI in Salesforce. Every night for example.

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    Popular Salesforce Blogs

    Salesforce Admin or Salesforce Consultant?

    Blog in Salesforce Career

    Salesforce is a tool that can literally revolutionize your business. For salespeople, it’s a turbocharged tool that manages the entire process from lead to closed…

    Salesforce Admin, Salesforce Administrator, Salesforce Career, Salesforce Certifications, Salesforce Consultant
    Simplilearn May 2, 2019
    2,588  Views

    Integrating Single Salesforce Org With Multiple Jira Instances with Sinergify

    Blog in Salesforce integration

    Why the need for different Jira instances within the same organization? As we all know, Salesforce is a CRM platform and organizations use it for…

    Atlassian Jira, Communication and Collaboration, CRM Platform, Customer Data-related Activities, Integrate Multiple Jira Instances
    Shubham Mar 22, 2021
    3,273  Views

    Salesforce Nonprofit Success Pack (NPSP): Get Started with a Free Trial

    Blog in Salesforce Products

    Choosing the right technology to manage your nonprofit’s operations, donor relationships, and programs is crucial for maximizing your impact. Salesforce’s Nonprofit Success Pack (NPSP) is…

    Campaign, Campaign Members, Campaigns In Salesforce, Case Management, Connector
    DB Nov 11, 2025
    242  Views

    Popular Salesforce Videos

    How Cross Channel Marketing Can Drive More Engagement ? | Salesforce Marketing Cloud

    How Cross Channel Marketing Can Drive More Engagement ? | Salesforce Marketing Cloud

    Video in Marketing, Salesforce Training

    Cross-channel marketing is a customer-focused digital marketing technique used by marketers globally to provide an integrated experience across all paid, owned, earned media, and digital…

    Salesforce Training, Salesforce Tutorial, Salesforce Marketing Cloud, Salesforce Webinar, Salesforce Video
    Cyntexa Jan 11, 2023
    1,326  Views
    Top 5 Benefits of Salesforce Financial Service Cloud

    Top 5 Benefits of Salesforce Financial Service Cloud

    Video in Salesforce Cloud Platform

    Built on the Salesforce Customer Success Platform, Financial Services Cloud includes an enhanced set of features created specifically for client engagement and designed with the…

    Salesforce Training, Salesforce Tutorial, Salesforce Cloud, Salesforce Learning, Salesforce Financial Service Cloud
    Cyntexa Sep 28, 2022
    2,032  Views
    Configuration Attribute In Salesforce CPQ | Salesforce Development Tutorial | Learn Salesforce Series by Algoworks

    Configuration Attribute In Salesforce CPQ | Salesforce Development Tutorial | Learn Salesforce Series by Algoworks

    Video in Salesforce Training

    Configuration attributes can be used in setting up the value of multiple shared product option fields simultaneously in Salesforce CPQ. In this Salesforce tutorial, you…

    Salesforce Training, Salesforce Tutorial, Salesforce CPQ, Salesforce Development Tutorial, Salesforce Video
    Algoworks Nov 30, 2020
    8,127  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.