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
Aladin BanwalAladin Banwal 

Can we write Batch Apex to update custom picklist field in User object?

global class memberBirthdayBatch implements Database.Batchable<sObject>{
    global Database.querylocator start(Database.BatchableContext BC){
    	return Database.getQueryLocator([select id, water_demo__Birthday__c from User]);
    }
	global void execute(Database.BatchableContext BC, List<User> us){
        for(User u : us){
            u.water_demo__Birthday1__c= 'Today';
        }
        try {
            update us;
         
        } catch(Exception e) {
            System.debug(e);
        }
    }
    global void finish(Database.BatchableContext BC){
    }
}
Actually, I've used this same code for Account object and it's working fine but when I change it for User it is not working
I've scheduled this batch class for daily.
Raj VakatiRaj Vakati
Code looks clean to me .. can you check the debug logs why its failing >>>