You need to sign in to do that
Don't have an account?
Stuart Werner
can I use Apex Batch to copy data from one object to another?
We have a need to copy the data from the LoginHistory object to a custon loginHistory object on a regular basis. This is a large organization with a lot of activity. I know we can do this manually with the dataloader.
Can an Apex Batch job support this type of activity?
Can anyone point us to some sampple apex code that copies data from one object to another?
Thanks
Can an Apex Batch job support this type of activity?
Can anyone point us to some sampple apex code that copies data from one object to another?
Thanks
Next, your execute method would create a new list of custom LoginHistory records and then insert them. Note that the max batch size is 200 records, so that means your batch job will run in "chunks" of 200 records at a time, but for simply copying from one object to another, you should have no problem with that.
To run the batch job on a regular basis, you'll want to call it from a Schedulable class. See here for more info on that: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm
Below is an example of what your batch job may look like: