Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • 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
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • 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
    • Marketplace
    • Advertise With Us
    • 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 9 years, 10 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

    application solution

    Popular Salesforce Blogs

    Transforming Customer Engagement with Salesforce Experience Cloud: Best Practices

    Blog in Salesforce

    With high customer expectations in today's digital world, businesses must be at the forefront of customer engagement strategies. Salesforce Experience Cloud is the key to…

    CRM, CRM Analytics, Customer Engagement Tools, Customer Relationship Management, Customer Relationships
    TechForce Jul 24, 2024
    639  Views
    Salesforce Skype URIs

    Skype URIs in Salesforce (One Click to Call or Chat on Skype)

    Blog in Salesforce customization

    In this post, i will put a way to implement Skype URIs in 5 Minute with salesforce. Skype is a popular way to chat or calls. We have…

    Customer Success, Skype in Salesforce, Skype URI
    0to1Code.Com Aug 31, 2017
    8,742  Views

    Mastering Continuous Integration Top Tools and Techniques for DevOps

    Blog in Salesforce

    In today's digital environment, such innovation has to be very fast and efficient to outcompete others. Continuous Integration has become the bedrock of DevOps practices…

    Automated Testing Suite, Build Times, CI Pipelines, CI Techniques, CI Tools
    TechForce Jul 29, 2024
    528  Views

    Popular Salesforce Videos

    Signing Up for a Free Salesforce Account

    Signing Up for a Free Salesforce Account

    Video in Others

    From Salesforce instructor, Become a Salesforce Expert. Sign up for a free Salesforce account and learn more about this technology. Mike Wheeler - http://mikewheelermedia.com

    Salesforce Tutorials, Salesforce Instructor, Salesforce Expert, Salesforce Account
    lavish Oct 18, 2019
    2,323  Views
    How to Use Salesforce for Project Management

    How to Use Salesforce for Project Management

    Video in Salesforce Stories

    When you think of CRM software, "Salesforce" is probably one of the first words that comes to mind. But Salesforce can do so much more…

    Salesforce Training, salesforce, Salesforce Video, Salesforce Learning, Salesforce AppExchange
    Nauman Aug 16, 2021
    2,422  Views
    Salesforce Platform Quick Tip: How to Access Popular Items in a Single Click

    Salesforce Platform Quick Tip: How to Access Popular Items in a Single Click

    Video in Salesforce Stories

    Want to get to the things you use most with fewer clicks? Trailblazer and Senior Salesforce Developer, Ellie Matthewman shows us how to use favourites…

    Salesforce Tutorial, Salesforce Developer, salesforce, salesforce platform, Salesforce Video
    Jogender Oct 20, 2021
    2,041  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®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.