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
DoondiDoondi 

Update record without any action?

Hi,
I have custom object: School__c, in that I have a (checkbox)custom field: Old student__c.
There are more than 1000 records in that school object.

I want to udpate Old Student__c =true.

I don't want to edit each and every record and do it manually.
I don't want to bring back data with tools and again update-it's RISKY
Let me know How I can achive this.

Thanks in advance. 
 
Best Answer chosen by Doondi
Steven NsubugaSteven Nsubuga
Use the Developer Console and run this code.
Find it
User-added image
Then
User-added image
Then copy and paste the code below into the resultant code window
List<School__c> schools= [SELECT Id, Old_student__c FROM School__c WHERE student__c = false];
for (School__c school : schools) {
   school.Old_student__c= true;
}
database.update(schools);​

 
paste the code above into the resultant code window
User-added image
Click Execute

All Answers

Steven NsubugaSteven Nsubuga
Use the Developer Console and run this code.
Find it
User-added image
Then
User-added image
Then copy and paste the code below into the resultant code window
List<School__c> schools= [SELECT Id, Old_student__c FROM School__c WHERE student__c = false];
for (School__c school : schools) {
   school.Old_student__c= true;
}
database.update(schools);​

 
paste the code above into the resultant code window
User-added image
Click Execute
This was selected as the best answer
DoondiDoondi
Thanks Steven Nsubuga, I helped me to my work easily.
But wanted to know if this is the standard way or best to do if we playing with more data?
Steven NsubugaSteven Nsubuga
This is what we do for ad hoc, one off scenarios. If this is something you do regularly then automating it via scheduled apex,or a combination of scheduled and batch apex is the way to go.
DoondiDoondi
No, we don't do regularly, We have process builder to display related records based on that condition. So taking extra care so that I should not be blammed for. 
Tristan PriorTristan Prior
Realme is a well known and eminent brand. I am a major fanatic of realme handsets. The models appeared here for example Realme X50 5G and they provide amazing reviews here http://www.resumehelpaustralia.com/australian-help-review/ for batter experience, and Realme X50 Master 5G appears to be extraordinary with respect to their highlights.
Mohan UppalapatiMohan Uppalapati
I'm trying the same for territories. i wanted to update territories. I want the old records remain to be the same. But i need the future records to take affect from new rule.