Activating Cycle Plan Batch Processes

  • Online

Classic Cycle Plans can be updated nightly with calls and details. When the scheduled job process runs, it calculates all calls for the targets in the cycle plan and updates the Actual counts. This allows for easier organization of custom code for a customer, for example, customers can create or view the Apex Class screen or use it for job scheduling. This also keeps the delivered apex classes as a backup for reference.

Configuring Cycle Plan Batch Processes

Ensure initial configuration is complete before enabling this functionality.

To activate Classic Cycle Plan Batch Processes:

  1. Ensure the System Administrator Profile has Security access to the following two classes: 
  • VEEVA_BATCH_CYCLE_PLAN_CALC
  • VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS
  1. Create an Apex Class that implements Schedulable. This class must instantiate the two classes mentioned above. You can also add any business logic, for example, tracking both saved and submitted calls, to this class to fit your organization’s needs. An example class could be the following: 

global class scheduleCallCalc implements Schedulable{

global void execute(SchedulableContext sc) {

/* Perform any pre-processing for your organization then call the two

functions below*/

VEEVA_BATCH_CYCLE_PLAN_CALC b = new VEEVA_BATCH_CYCLE_PLAN_CALC();

database.executebatch(b,100);

VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS c = new VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS ();

database.executebatch(c,100);

}

}

  • You will need to schedule this job to run at a recurring interval:
  • On the Apex Classes page, click the Schedule Apex button.
  • Give the job a name
  • Select the class that you created above
  • Set your run frequency for your job – it is recommended to run the process during off-peak hours

If business processes require modification of the delivered call and detail counting, the above mentioned classes should be copied to new classes and prefixed with an identifier, such as the customer name.

The process to modify the delivered classes is as follows:

  1. Clone (and rename) the VEEVA_BATCH_CYCLE_PLAN_CALC and VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS Apex classes.
  2. Modify the logic within the cloned class(es) to account for the specific business rules employed within the organization

An example of such logic modification could be only counting calls of type Detail

  • Clone scheduleCallCalc to reference new classes for scheduling the batch job