Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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 force.com 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
add comment

1 Answer 1

up vote 1 down vote accepted

This requirement for you is good exercise as a fresher.

Please follow the apex workbook

http://www.salesforce.com/us/developer/docs/apex_workbook/apex_workbook.pdf

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
add comment

Your Answer

 
discard

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.