Creating the CT CPG Activity and CT CPG Activity Data Records

The following Apex classes are used to create a record of the custom CT CPG Activity object and a related record of the custom CT CPG Activity Data object:

  • ActivityProcessHandler

  • GlobalActivityService

The Apex classes are invoked by the following Apex trigger:

  • ActivityProcess

Before implementing, the system checks that the ActivityProcess trigger has a corresponding record in Trigger Settings.

The ActivityProcessHandler Class

The following trigger methods of the ActivityProcessHandler class are implemented:

You can restrict one or more trigger events to not invoke the trigger methods.
ActivityProcessHandler Method Execution

onBeforeInsert

  • Create a CT CPG Activity record linked to the Contact and/or Account records;

  • Assign the related Marketing Cycle record;

  • Link the corresponding Target Frequency record;

  • Fill in Objectives if specified.

onBeforeUpdate

For the CT CPG Activity record:

  • Assign the related Marketing Cycle record;

  • Link the corresponding Target Frequency record;

  • Fill in Objectives if specified.

onBeforeDelete

Search and delete the standard Event and Task records that are related to deleted CT CPG Activity records.

onAfterInsert

  • Create the corresponding CT CPG Activity Data record for the CT CPG Activity record;

  • Calculate finished activities and fill in the Actual Calls field of the related Target Frequency record;

  • Add Objectives if specified;

  • Grant access to the Joint Visit Report for relevant users if specified;

  • Create the Event or Task records in case Activity Sync is configured.

onAfterUpdate

  • Update the corresponding CT CPG Activity Data record for the CT CPG Activity record;

  • Recalculate finished activities and fill in the Actual Calls field of the related Target Frequency record;

  • Create the related CT CPG Activity records in case of the Next Call functionality is configured.

  • Grant access to the Joint Visit Report for relevant users if specified.

onAfterDelete

When the CT CPG Activity records are removed, recalculate the finished activities in the Actual Calls field of the corresponding Target Frequency record.

``