ActivityProcess

ActivityProcess is intended to manage custom CT Pharma Activity records, as well as standard Event and Task records in case of using the Activity Sync functionality, according to the specified business logic.


API-name: CTPHARMA__Activity__c


Context Method Codename Execution

after insert [ai]

createRelatedData()

createRD

Create child records of the CTPHARMA__ActivityData__c object related to the parent record of the CTPHARMA__Activity__c object according to the values of the CTPHARMA__MarketingDetailTracking__c records associated with the corresponding active record of the CTPHARMA__MarketingCycle__c object and according to the CTPHARMA__CreateRelatedActivityDataRecords__c flag in the CTPHARMA__ApplicationSettins__c custom setting.

calculateFinishedActivity()

calcFA

Calculate the finished activities of the CTPHARMA__Activity__c and set this value to the related record of the CTPHARMA__TargetFrequency__c object.

storeObjectives()

storeObj

If the value in the CTPHARMA__NextCallObjective__c field is specified, add it to the record of the CTPHARMA__Objective__c object which is related to the Account or Contact object.

manageActivityShares()

manageAS

Grant access to the user which is specified in the CTPHARMA__UserId__c field on the record of the CTPHARMA__Activity__c object with the Joint Visit record type, if the CTPHARMA__IsJointActivityShareEnabled__c flag is set in the CTPHARMA__ApplicationSettings__c custom setting.

hasRelatedActivitiesCheckForNewRecords

checkRAInsert

Update the value in the CTPHARMA__HasRelatedActivities__c field of the related records of the CTPHARMA__Activity__c object with the Joint Visit record type.

If the records of the CTPHARMA__JointVisitReport__c were not attached before, the value is changed from False to True.

createRelatedActivities()

createRA

Update the value in the CTPHARMA__HasRelatedActivities__c field of the related records of the CTPHARMA__Activity__c object with the Joint Visit record type. If the records of the CTPHARMA__JointVisitReport__c were not attached before, the value is changed from False to True.

after update[au]

createRelatedData

createRD

Update child records of the CTPHARMA__ActivityData__c object related to the parent record of the CTPHARMA__Activity__c object according to the values of the CTPHARMA__MarketingDetailTracking__c records associated with the corresponding active record of the CTPHARMA__MarketingCycle__c object and according to the CTPHARMA__CreateRelatedActivityDataRecords__c flag in the CTPHARMA__ApplicationSettins__c custom setting.

recalculateActivityActualCalls

calcActAC

Recalculate the finished activities of the CTPHARMA__Activity__c and set this value to the related record of the CTPHARMA__TargetFrequency__c object.

storeObjectives

storeObj

Update the record of the CTPHARMA__Objective__c object which is related to the Account or Contact object, if the value in the CTPHARMA__NextCallObjective__c field has been changed.

createNextActivities

createNA

Create the next one record of the CTPHARMA__Activity__c object, if the value in the CTPHARMA__NextCallDate__c field is specified.

transferNextDateToChildrenVisit

transferNextDates

Update related records of the CTPHARMA__Activity__c object, if the value in the CTPHARMA__NextCallDate__c field has been changed.

manageActivityShares

manageAS

Update access to the user which is specified in the CTPHARMA__UserId__c field on the record of the CTPHARMA__Activity__c object with the Joint Visit record type, if the CTPHARMA__IsJointActivityShareEnabled__c flag is set in the CTPHARMA__ApplicationSettings__c custom setting.

hasRelatedActivitiesCheckAfterUpdate

checkRAUpdate

Update the value in the CTPHARMA__HasRelatedActivities__c field of the related records of the CTPHARMA__Activity__c object with the Joint Visit record type.

  • If the records of the CTPHARMA__JointVisitReport__c were not attached before, the value is changed from False to True.

  • If, after the update, there are no attached records of the CTPHARMA__JointVisitReport__c left, the value is changed from False to True.

after delete[ad]

recalculateActivityActualCallsAfterDelete

calcActAC

Update the value in the CTPHARMA__ActualCalls__c field and the date of the last activity in the CTPHARMA__LastCallDate__c field of the CTPHARMA__TargetFrequency__c records, which are related to the removed records of the CTPHARMA__Activity__c.

before insert[bd]

fillAccountAndContactFromReference

fillAAC

If the value is specified in the CTPHARMA__ReferenceId__c field, then the CTPHARMA__AccountId__c and CTPHARMA__ContactId__c fields are filled in the corresponding record of the CTPHARMA__Activity__c object.

fillObjectives

fillObj

If the CTPHARMA__IsObjectivesEnabled__c flag is set in the CTPHARMA__ApplicationSettings__c custom setting, a record of the CTPHARMA__Objective__c object is created, and the CTPHARMA__StartDate__c field of the record of the CTPHARMA__Activity__c is specified, then the value from the record of the CTPHARMA__Objective__c object will be added to the CTPHARMA__Objective__c field of the corresponding record of the CTPHARMA__Activity__c.

  • If the objective is specified for the record of the Contact object, the CTPHARMA__Objective__c field will be filled for the CTPHARMA__Activity__c of this contact’s record.

  • If the objective is specified for the record of the Account object, the CTPHARMA__Objective__c field will be filled for the CTPHARMA__Activity__c of this Account.

fillMarketingCycle

fillCycle

Map a record of the CTPHARMA__Activity__c object and a record of the CTPHARMA__MarketingCycle__c object in the CTPHARMA__MarketingCycleId__c field, if the marketing cycle is active, the maximum number of days of this cycle is less than or equal to the value specified in the CTPHARMA__MaxPlanningDays__c field of the CTPHARMA__ApplicationSettings__c custom setting, the value in the CTPHARMA__StartDate__c field of the record of the CTPHARMA__Activity__c is changed, the user and marketing cycle divisions are the same, and the corresponding parameter for this type of activity is specified in the CTPHARMA__MarketingLinkSettings__c.

fillTargetFrequency

fillTF

The corresponding record of the CTPHARMA__TargetFrequency__c object will be specified.

before update[bu]

fillObjectives()

fillObj

If the CTPHARMA__IsObjectivesEnabled__c flag is set in the CTPHARMA__ApplicationSettings__c custom setting, a record of the CTPHARMA__Objective__c object is created, and the CTPHARMA__StartDate__c field on the record of the CTPHARMA__Activity__c is specified, then the value from the record of the CTPHARMA__Objective__c object is added to the CTPHARMA__Objective__c field of the corresponding record of the CTPHARMA__Activity__c.

  • If the objective is specified for the record of the Contact object, the CTPHARMA__Objective__c field will be filled for the CTPHARMA__Activity__c of this Contact.

  • If the objective is specified for the record of the Account object, the CTPHARMA__Objective__c field will be filled for the CTPHARMA__Activity__c of this Account.

fillMarketingCycle()

fillCycle

Map a record of the CTPHARMA__Activity__c object and a record of the CTPHARMA__MarketingCycle__c object in the CTPHARMA__MarketingCycleId__c field, if:

  • the marketing cycle is active, the maximum number of days of this cycle is less than or equal to the value specified in the CTPHARMA__MaxPlanningDays__c field in the CTPHARMA__ApplicationSettings__c custom setting,

  • the value in the CTPHARMA__StartDate__c field of the record of the CTPHARMA__Activity__c is changed,

  • the user and marketing cycle divisions are the same,

  • the corresponding parameter for this type of activity is specified in the CTPHARMA__MarketingLinkSettings__c.

fillTargetFrequency()

fillTF

The corresponding record of the CTPHARMA__TargetFrequency__c object will be specified.

before delete[bd]

bd

Remove the records of the standard Event and Task objects related to the removed records of the CTPHARMA__Activity__c.

``