function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
anil 007anil 007 

plz help to write schedule and batch apex class for the requirement

hiii,

 

i  need to create a Class to house most of your code methods to actually do the processing, and then have a separate Class defined as Schedulable, which calls the methods in your other class. I’d like you to build the “called” Class first, and then the actual Scheduler.i need to write batch and schedule apex class for the following requirement.

 

 

Query Tasks and Events to make sure these fields are up to date. Since this will run every day after midnight, you will only need to act on situations where (What.Type = ‘Opportunity’) and ( (ActivityDate = yesterday) or (LastModifiedDate = yesterday)). Use the WhatIDs from those Activities to query the Opportunities in question.

 

  • Opportunity fields to update:

o   Most Recent QA Call Date (Events)

§  Event.Event_Type__c = "QA Call", max (date) <= today

o   Most Recent QA Call Grade (Events)

§  Event.Event_Type__c = "QA Call", max (date) <= today

o   Next PA Date (Events)

§  Event_Type__c = "Phone Appointment"  MIN(ActivityDate) >= TODAY

o   How many prewires were completed (Tasks)

§  Count of Tasks on Opportunity where Task Type = Prewire and Status = Scheduled OR Completed AND Start Date < Today

 

plz  help me to solve this one

 

Thanks in advance

 

Anil Kumar

 

 

 

 

hisrinuhisrinu

Here is an example for batch apex

 

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_batch_interface.htm|StartTopic=Content%2Fapex_batch_interface.htm|SkinName=webhelp