Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am new to SalesForce. My goal is to create a scheduled Apex function that runs once all 24hours that just copies Account.Field("field1").Value to Account.Field("field2").Value. Is there a good example code page or tutorial to do this?

share|improve this question
Is there a reason you don't want to do this realtime with a trigger? Do you want to do this for every account? – Peter Jan 24 '13 at 16:29
yes, it should only be all 24 hours using the "schedule apex" function. And yes it should be for every account. Background: I have a data_today field and a data_daybefore field. I just want to save a copy of todays data to a separate field so I can compare my data with that on the day before – user670186 Jan 24 '13 at 16:36
@user670186 For learning the apex workbook is better if you are new to platform – Mohith Shrivastava Jan 24 '13 at 16:51
An alternative to this could be to turn on Field History Tracking. – Daniel Hoechst Jan 24 '13 at 20:30
up vote 1 down vote accepted

This requirement for you is good exercise as a fresher.

Please follow the apex workbook

Chapter 14 and chapter 15 has an example on Schedulable job and batch and you may tweak to adjust to your requirement.

share|improve this answer
Thanks you! The examples are very generic though, I will try – user670186 Jan 24 '13 at 17:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.