Activating Cycle Plan Batch Processes
- Browser
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:
- Ensure the System Administrator Profile has Security access to the following two classes:
- VEEVA_BATCH_CYCLE_PLAN_CALC
- VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS
- 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:
- Clone (and rename) the VEEVA_BATCH_CYCLE_PLAN_CALC and VEEVA_BATCH_CYCLE_PLAN_CALC_CALLS Apex classes.
- 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
Using Cycle Plan Batch Processes
When the cycle plan batch process runs, active cycle plans which meet the criteria in the CALC_CYCLE_PLAN_vod Veeva Setting are processed and cycle plan calculations are updated to reflect recent activities.
For eligible cycle plans, the following fields are updated on Cycle Plan Target records:
- Actual Calls - This is the count of completed calls matching the criteria in the CALC_CYCLE_PLANS_ACTUAL Veeva Message, for the target account. By default, this includes saved or submitted calls with a call date within the cycle plan's start and end dates, and a territory matching the cycle plan's assigned territory.
- Scheduled Calls - This is the count of scheduled (but not yet completed) calls matching the criteria in the CALC_CYCLE_PLANS_SCHEDULED Veeva Message, for the target account. By default, this includes calls scheduled within the cycle plan's start and end dates with a call date ahead of the current date, and a territory matching the cycle plan's assigned territory.
- Total Actual Calls - The total count of completed calls within the cycle plan time frame for the target account, regardless of territory
- Total Scheduled Calls - The total count of scheduled calls within the cycle plan time frame for the target account, regardless of territory
If product detail goals are defined (the Planned Details field is populated on the Cycle Plan Target record), the following fields are updated:
- Actual Details - This is the count of calls with product details matching the criteria in the CALC_CYCLE_PLANS_ACTUAL Veeva Message, for Cycle Plan Detail products specified for the target account. By default, this includes saved or submitted calls with a call date within the cycle plan's start and end dates, and a territory matching the cycle plan's assigned territory.
- Scheduled Details - This is the count of scheduled (but not yet completed) calls with product details matching the criteria in the CALC_CYCLE_PLANS_SCHEDULED Veeva Message, for a target account. By default, this includes calls scheduled within the cycle plan's start and end dates with a call date ahead of the current date, and a territory matching the cycle plan's assigned territory.
If Total Goals are defined for product detailing (the Planned Total Details field is populated on the Cycle Plan Detail record), the following additional fields are updated, counting all calls with product details within the cycle plan time frame for the target account, regardless of territory:
- Total Actual Details - The total count of calls with product details
- Total Scheduled Details - The total count of scheduled calls with product details