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
Money Care 7Money Care 7 

How to change default value Automatically

Hi All
I have one goal and how to solve this .i have 500 existing record one of my object.in this object one field (%) with default value 10%. i need to chnage that field with 5% from 1st june .how it is possible
Pankaj_GanwaniPankaj_Ganwani
You can do this from developer workbench or data loader. Just extract entire data of this object and then update the field value to 5% in CSV and again update it through workbench or data loader whichever tool you are using.
Gabriel ArribasGabriel Arribas
Hi,

You could use data loader to mass update them.
Build report of the leads you want ot update (include the Record ID field for reference) and export it to csv file. 
Modify the field desired.
Use the update function of Open data loader.

I hope this help you.
Money Care 7Money Care 7
Thanks to all for quick reply.. no need for manual process ,requirement is from 1st june it will be updated the default value automatically
Gabriel ArribasGabriel Arribas
and on this way?

List<Object> oList= [SELECT Id, Name FROM Objet];
for(Object o :oList){
       o.Name = 'something';
}
update oList;
Pankaj_GanwaniPankaj_Ganwani
If you want this process to be automatic, you will have to go for the schedule apex which will run once in a year on 1st June.
Gabriel ArribasGabriel Arribas
Create a Scheduled Class like this:

global class ScheduledUpdatePercent implements Schedulable {
      global void execute(SchedulableContext ctx) {
           List<CustomObject> objectList = [Select id, Percent_Field__c from CustomObject];
           for(CustomObject co : objectList){
                       co.Percent_Field__c = 5;
            }
        update objectList;
    }        
}

and Open Execute Anonymous Windows schedule the job (Developer Console). For example:
           System.schedule('UpdatePercentToday', '0 00 14 2 6 ? 2016', new ScheduledUpdatePercent());

This execute the job once, today at 14:00.

I hope this let you achieve your Goal.