---
schema_version: "1"
id: a33b922af091b808e572658517a00295a5811d10e9195409dafc069985fc4049
title: APEX Configuration
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/apex_setup.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/apex_setup.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7bb6c5779b6f7514a9ec035638154f0b616d9b70d2f0213747f6faea13a74ce7
description: In order to customize the Promotion Save process in APEX layer, you must introduce a callable APEX class as a customization hook.
---
# APEX Configuration

In order to customize the Promotion Save process in APEX layer, you must introduce a callable APEX class as a customization hook.

In order to setup the hook, go to Setup → Custom Metadata Types → CGCloud Process Customization , and add the following records:

- Label: TPM\_Promotion\_Save
- DeveloperName: TPM\_Promotion\_Save
- Class: <Your Callable APEX Class>
- Enabled: checked
- Method: save

**APEX class structure**

global class <Your Callable APEX Class> implements System.Callable {

    global Object call(String action, Map<String, Object> args) {
        // Get the TPM\_Promotion instance from the arguments
        TPM\_Promotion promotion = (TPM\_Promotion) args.get('promotion');
        // Retrieve your custom state sent to UI
        String payload = (String) args.get('customState');
        // Read Transaction Id
        String txId = (String) args.get('txId');
        
        // Your custom logic goes here
    }
}

The call method is called during the Promotion Save Process. At this method, you can add your customizations to the process:

- Create additional records
- Modify TPM records

![Note](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/images/icon_note.png)

#### Note

The TPM\_Promotion instance contains an object with all the Managed Package Promotion data.