function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gattam Rakesh (SFDC)Gattam Rakesh (SFDC) 

How to inactive a user using batch apex if the user has not logged for 90days??

global class Inactiveuser implements Database.Batchable<sObject>
{
    global Database.QueryLocator start(Database.BatchableContext BC)
    {
        String query = 'SELECT Id,Name,Isactive From User WHERE Isactive=TRUE';
        return Database.getQueryLocator(query);
        
    }
    
     global void execute(Database.BatchableContext BC, List<user> scope)
    {
        for(user a : scope)
         {
           if(a.LastLoginDate> )
           
          {
          
          
          
          } 

         }
         update scope;
    }   
    global void finish(Database.BatchableContext BC)
    {
    }
}
NagaNaga (Salesforce Developers) 
Hi Rakesh,

Please see the code below and let me know

User-added image

Best Regards
Naga Kiran