You need to sign in to do that
Don't have an account?
Joshua Hric
Creating an Apex Trigger to update all records on a custom object
I am relatively new to Apex, and I need help with an Apex Trigger that updates all records on a custom object on a daily basis. The only criteria to not update the record is if "Status" picklist = "Contract Received". I assume you can use a simple for loop to set the criteria, and any help or assistance on the topic is greatly appreciated.
public class updateContracts {
public static void checkUpdate(Object__c[] objects){
for(Object__c obj: objects){
if(obj.Status__c=='Contract Received'){
continue;
}
else{
// code to update record with
}
}
}
}
Once you finish the class, you can go to Setup -> App Setup ->Develop -> Apex Classes and click on the "Schedule Apex" button and set up this class to run on the days/times you'd like.
Hope this helps and welcome to Apex!
All Answers
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
public class updateContracts {
public static void checkUpdate(Object__c[] objects){
for(Object__c obj: objects){
if(obj.Status__c=='Contract Received'){
continue;
}
else{
// code to update record with
}
}
}
}
Once you finish the class, you can go to Setup -> App Setup ->Develop -> Apex Classes and click on the "Schedule Apex" button and set up this class to run on the days/times you'd like.
Hope this helps and welcome to Apex!