Contract Management on salesforce provides the following callback interfaces:

IAgreementLifecycleCallback2

The administrator can use this callback class to handle the Agreement lifecycle specific actions like afterCreate , afterClone, afterTerminate, afterAmend, and so on.

IDynamicSectionCallback2

The administrator can use this callback class to handle the dynamic section when an agreement document is generated.

To enable the callback interface for IAgreementLifecycleCallback2

  1. Write a class implementing the Interface. 
  2. Overwrite the methods and write what you want to add in a specific action method.
  3. Go to Setup > Custom SettingsComply Custom Classes.
  4. Create a New Entry.
  5. Execute actual Action and check the log.
  6. Create Apex Class implementing the Callback Interface.

Callback Methods Invoked

S.No

Callback Method

When is the callback method invoked

01

afterActivate

After Agreement is Activated

02

afterAmend

After Agreement is amended

03

afterCancel

After Agreement is canceled

04

afterClone

After Agreement is Cloned

05

afterComplete

Called After Every Action (ActionType is Sent as Parameter to the method)

06

afterCreate

After New Agreement is created

07

afterCreateChild

After New Child Agreement is Created  

08

afterCreateExecuted

After create of Store Executed Agreement

09

afterCreateFromOpportunity

After New Agreement is created for Opportunity

10

afterCreateOffline

After offline Agreement is created

11

afterExpire

After Agreement is expired

12

afterRenew

After Agreement is Renewed

13

afterTerminate

After Agreement is Terminated

IAgreementLifecycleCallback2

global class APTS_CustomAgreementLifecycleCallback implements CustomClass.IAgreementLifecycleCallback2 {

    global void afterActivate(APTS_Agreement__c originalSO, CustomClass.ActivationType activationType){
        logMessage('Action after Activate' , 'After Activate');
    }
                
    global void afterAmend(APTS_Agreement__c originalSO, APTS_Agreement__c amendmentSO){
        logMessage('Action after Amend' , 'After Amend');
    }
    global void afterCancel(APTS_Agreement__c agreementSO){
        logMessage('Action after Cancel' , 'After Cancel');
    }
    global void afterClone(APTS_Agreement__c originalSO, APTS_Agreement__c cloneSO){
    	logMessage('Action after Clone' , 'After Clone');
    }
    global void afterComplete(APTS_Agreement__c agreementSO, CustomClass.ActionType actionType){
       logMessage('Action after Complete' , ''+actionType);
    }
    global void afterCreate(APTS_Agreement__c agreementSO){
        logMessage('Action after Create' , 'After Create');
    }
    global void afterCreateChild(APTS_Agreement__c parentSO, APTS_Agreement__c childSO){
         logMessage('Action after Create Child ' , 'After Create '+childSo);
    }
    global void afterCreateExecuted(APTS_Agreement__c agreementSO){
        logMessage('Action after Executed' , 'After Execute '+agreementSO);
    }
    global void afterCreateFromOpportunity(APTS_Agreement__c agreementSO){
        logMessage('Action after Create agreement from Opp' , 'After Create');
    }
    global void afterCreateOffline(APTS_Agreement__c agreementSO){ 
            logMessage('Action after Create offline' , 'After Create');
    }
    global void afterExpire(APTS_Agreement__c agreementSO){ 
            logMessage('Action after Expire' , 'After Expire');
    } 
    global void afterRenew(APTS_Agreement__c originalSO, APTS_Agreement__c renewalSO){
             logMessage('Action after Renew' , 'After Renew');
   
    }
    global void afterTerminate(APTS_Agreement__c agreementSO){ 
            logMessage('Action after Terminate' , 'After Terminate');
    }
    
    private void logMessage(String message , String action){
        System.debug('[LifecycleCallback ('+action+')] :'+message);
    }
}
CODE