+ Start a Discussion
raysfdc1988raysfdc1988 

Apex Scheduler help -

I need write schedulable apex for following prob..

I have contacts and Accounts standard object and one custom object attendance

Now for account-X there are two contact roles ->p and q-->

and Attendence is child object of contacts--

So for contact-->P -there are two attendence records wit status(data)-->1.payable and 2.Nonpayble


So for contact-->q there are two attendence records wit status(data)-->1.payable and 2.Nonpayble

Now I need write apex code to create a opportunity for this account X-
And I want add products to this opportunity

But I have already two products-Payable and Non payable with standard price

So for this opportunity i need to add this products accourding to the attendence records count of contact..

Ex:For X account opportunity---> there will be 4 produts(2-payable n 2-non payable)

Now I need apex code which will automaticaly create this opportunity and add products to it according to the contact attendence record.

and I want run this code once in a month..using scedule apex;

I think this very difficult , I am tring it from a weak...

Please help me to write this code..Even any reffence will also help me lot..
Yoganand GadekarYoganand Gadekar
see if this helps you out:
Here is an example of batch apex that you can refere:
http://www.cloudforce4u.com/2013/07/batch-apex-example.html

and here you can see how a batch apex can be scheduled to run:
http://www.cloudforce4u.com/2013/09/batch-apex-scheduling-in-apex-batch.html